Gmail api线程列表代码段

tra*_*nqy 5 python gmail-api

我一直在尝试使用GMail API和客户端库.我可以使用javascript节点SDK来获取线程列表,但代码片段会以""形式返回.

client.gmail.users.threads.list({userId: "me"}).withAuthClient(auth_with_access_token).execute(function (err, response) {
            res.json({complete: response.threads})
        });
Run Code Online (Sandbox Code Playgroud)

然后我下载了python SDK,并使用gmail api示例获得了一个线程列表,并注意到它们也有空片段.

for thread in threads['threads']:
    print 'Thread: %s' % (thread)
Run Code Online (Sandbox Code Playgroud)

主题ID:{u'snippet':你','你':u'146fccb21d960498',u'historyId':u'7177452'}

当我通过get thread方法请求线程时,我确实得到了一个片段,但是它只在线程列表中丢失了.

我需要在获取代码段的请求中包含其他详细信息吗?

谢谢!

Leo*_*onH 3

我可以通过使用此代码并进行身份验证来很好地获取消息片段:

message = service.users().messages().get(userId=user_id, id=msg_id, format='raw').execute()
print 'Message snippet: %s' % message['snippet']
Run Code Online (Sandbox Code Playgroud)

这显然是提取特定消息的片段,但原则仍然存在。

尝试一下,它应该可以工作,如果不评论这个答案,我会尽力提供帮助。