用户配置文件gmailapi中的历史id是什么?

2024-10-02 18:19:33 发布

您现在位置:Python中文网/ 问答频道 /正文

得到了这个输出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))

Tags: fromimportcomdatetimeis时间gmailuserinfo
1条回答
网友
1楼 · 发布于 2024-10-02 18:19:33

Anwser:HistoryID不是epoc time,而是id

历史ID的定义

直接从doucmentation 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

相关问题 更多 >