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

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?

About this issue

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

Most upvoted comments

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