我正在使用 Google 新发布的 Gmail API 的 python 版本。
以下调用仅返回消息 ID 列表:
service.users().messages().list(userId = 'me').execute()
但后来我只有一个消息 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()