question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTTPSConnectionPool ERROR - Can we modify the $top value in query?

See original GitHub issue

I get the following error when pulling emails from an inbox.

HTTPSConnectionPool(host='graph.microsoft.com', port=443): Max retries exceeded with url: /v1.0/users/myemail@mydomain.com/mailFolders/Inbox/messages?%24top=999&%24expand=attachments%28%24select%3Dname%29 (Caused by ResponseError('too many 504 error responses'))

If i use the following code to limit the number of emails to process, it seems to work: messages = inbox.get_messages(limit=20, batch=20, query=q) But when I change to this, it will idle for a bit then spit out the error above: messages = inbox.get_messages(limit=None, batch=200, query=q)

Any way around this? Am i just hitting some MS Graph throttling limit?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
pythonista092920commented, Mar 16, 2021

I’ll try running it today with request_retries=None and requests_delay=500 and see what happens. Thank you @janscas

0reactions
pythonista092920commented, Jun 24, 2021

@arkadas19

I actually still would have issues periodically. What I ended up doing was wrapping the calendar.get_events() method in a try except block and setting a 10 retry limit. Everything has ran perfect since making these changes. Maybe this code will help give you an idea.

`

  try:
        schedule = graph_account.schedule(resource=email)
        calendar = schedule.get_default_calendar()

        calender_events_not_retrieved = True

        loop_attempt = 0
        retry_attempt = 0
        while calender_events_not_retrieved:
            loop_attempt += 1

            if loop_attempt > 10:
                print("The loop has ran 10 times, quitting the program.")
                quit()

            if retry_attempt < 9:
                try:
                    graph_events = calendar.get_events(include_recurring=False, limit=None)
                    calender_events_not_retrieved = False

                except Exception as calender_not_retrieved_exc:
                    retry_attempt += 1
                    print(f"Hit calender_not_retrieved_exc: {calender_not_retrieved_exc}")
                    print(f"Could not pull calendar data from MS Graph, trying again. "
                          f"Starting reattempt {retry_attempt}")
                    time.sleep(60)

            else:
                print("Too many retry attempts, quitting the program. MS Graph servers appear to be not "
                      "accepting the requests.")
                quit()

    except Exception as get_calendar_data_exception:
        print(f"Hit the following exception: {get_calendar_data_exception}")

    print("Successfully pulled the calendar data")      

`

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTPSConnectionPool Max retries exceeded - Stack Overflow
I 've found that this error happens when some item in one of my views throws an exception. For example, when using the...
Read more >
ProxyError: HTTPSConnectionPool : Forums - PythonAnywhere
I have the same error raise ProxyError(e, request=request) ... Hi, I am having the same issue, can you please whitelist this: www.nba2k.io.
Read more >
Agent Proxy Configuration - Datadog Docs
Starting with Agent v6.4, you can set your proxy settings through environment variables: DD_PROXY_HTTPS : Sets a proxy server for https requests.
Read more >
Troubleshoot the Splunk Add-on for Microsoft Office 365
Click Save after you change permissions. Click Grant permissions to finish applying the permission changes. Cannot ingest Message Trace data after configuring a ......
Read more >
Resolve errors from API Gateway integration with Lambda ...
How can I resolve the errors that I receive when I integrate API Gateway with a Lambda ... query to search for Lambda...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found