python - 用户配置文件 gmail api 中的历史记录 ID 是什么?

标签 python google-api gmail-api google-api-python-client

得到这个输出,historyId 是什么意思,现在是纪元时间吗?

UserInfo is 
 {'emailAddress': 'sssss@gmail.com', 'messagesTotal': 22919, 'threadsTotal': 22016, 'historyId': '1727906'}

使用的代码

from googleapiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools
from dateutil.relativedelta import relativedelta
from datetime import datetime


SCOPES = 'https://www.googleapis.com/auth/gmail.readonly'


userInfo = service.users().getProfile(userId='me').execute()
print ("UserInfo is \n %s" % (userInfo))

最佳答案

Anwser:HistoryID 不是纪元时间,而是一个 ID。

历史ID定义

直接来自文档getprofile

historyId unsigned long The ID of the mailbox's current history record.

使用

history.list一起使用

Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing historyId).

也用于以下

将客户端与 Gmail 同步

使您的客户端与 Gmail 保持同步对于大多数应用场景都很重要。整体同步场景有两种:全同步和部分同步。客户端首次连接到 Gmail 以及其他一些罕见情况时需要完全同步。如果您的客户端最近进行了同步,则部分同步是比完全同步更轻量级的替代方案。您还可以使用推送通知仅在必要时实时触发部分同步,从而避免不必要的轮询。

您还可以找到sync

关于python - 用户配置文件 gmail api 中的历史记录 ID 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54781005/

相关文章:

java - Gmail-API JAVA客户端发送邮件权限不足

python - 如何在 mongodb 集合中搜索嵌套在数组中的字典键

python - Python 中的 Google 身份验证器实现

php - 尝试使用 PHP 从日历中获取事件列表

c# - 在非域帐户上将 Google API 与服务帐户凭据一起使用

php - Gmail 应用程序接口(interface)。如何获取消息标签

python - 从秩亏矩阵中提取线性独立行的例程

Python:正则表达式 findall 返回一个列表,为什么尝试访问列表元素 [0] 返回错误?

oauth-2.0 - 为生产系统恢复已删除的 (?) Google OAuth 客户端应用程序

python - 以编程方式发布包含用户指定的 HTML 和纯文本正文的 Gmail 草稿