def main():
store = file.Storage('token.json')
creds = store.get()
if not creds or creds.invalid:
flow = client.flow_from_clientsecrets('credentials.json', SCOPES)
creds = tools.run_flow(flow, store)
service = build('gmail', 'v1', http=creds.authorize(Http()))
# Call the Gmail API to fetch INBOX
results = service.users().messages().list(userId='me',labelIds = ['Label_21'], maxResults=600).execute()
messages = results.get('messages', [])
print (len(messages))
I am reading these specifically labelled messages that i get on a daily basis to archive them on my own custom application. I have more than 500 of these messages in my gmail account. But the api seems to be capped out at 500 of the most recent messages, even if i change maxResults to 600.
Does anyone else have this problem? Can anyone help please? I cant seem to find anything about .user.messages.list output limits in the docs. Image for clarification/proof