我正在使用Google新发布的Gmail API的python版本.
以下调用仅返回消息ID列表:
service.users().messages().list(userId = 'me').execute()
Run Code Online (Sandbox Code Playgroud)
但后来我只有一个消息ID列表,需要迭代它们并逐个获取它们.
有没有办法在单个调用中获取id列表的整个消息内容?(类似于在Google Calendar API中完成的操作)?
如果还不支持,Google会考虑在API中添加这些内容吗?
这是适合我的解决方案:
batch = BatchHttpRequest()
for msg_id in message_ids:
batch.add(service.users().messages().get(userId = 'me', id = msg_id['id']), callback = mycallbackfunc)
batch.execute()