5

我一直在尝试使用 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})
        });

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

for thread in threads['threads']:
    print 'Thread: %s' % (thread)

线程 ID: {u'snippet': u'', u'id': u'146fccb21d960498', u'historyId': u'7177452'}

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

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

谢谢!

4

1 回答 1

3

I can grab message snippets fine by using this code, following authentication:

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

This is obviously pulling a snippet for a particular message, but the principle remains.

Try this out and it should work, if not comment on this answer and I'll try to help.

于 2014-08-08T14:01:30.080 回答