Gmail API thread.list对于UNREAD查询返回错误的结果吗?

时间:2018-08-15 12:23:35

标签: gmail-api

在查询Gmail API thread.list方法中的未读电子邮件时,结果集似乎包含实际上不是未读邮件。为什么?

例如,users.threads.list(q="is:unread")返回的消息集比users.messages.list(q="is:unread")大得多。

或者,以代码形式:

...
query = "label:unread"
msgs = service.users().messages().list(userId="me", q=query).execute()
if 'messages' in msgs:
    print "\n%d messages matching query '%s'" % (len(msgs['messages']), query)

threads = service.users().threads().list(userId="me", q=query).execute()
if 'threads' in threads:
    print "%d threads matching query '%s'" % (len(threads['threads']), query)
...

结果:

4 messages matching query 'label:unread'
35 threads matching query 'label:unread'

此外,遍历users.threads.list()返回的线程和消息可确认正在返回线程,且带有UNREAD标签的线程中没有消息。

注意:

2018年8月更新::“经典” Gmail用户界面(不是API)的其他提示仅显示“ is:unread”的未读邮件。新的Gmail用户界面可以返回已读未读邮件,就像API一样。

0 个答案:

没有答案