【发布时间】:2020-11-10 07:53:44
【问题描述】:
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))
我正在阅读我每天收到的这些特别标记的消息,以便将它们存档在我自己的自定义应用程序中。我的 gmail 帐户中有超过 500 条此类消息。但是,即使我将 maxResults 更改为 600,该 api 似乎也被限制为 500 条最新消息。
还有其他人有这个问题吗?有人可以帮忙吗?我似乎在文档中找不到任何关于 .user.messages.list 输出限制的信息。 Image for clarification/proof
【问题讨论】: