Gmail API检索电子邮件,但没有他们的内容
我正在使用Gmail API为自己为自己制作一个简单的电子邮件摘要脚本,但是我遇到了一个问题,其中仅处理了一些电子邮件。例如,假设我有3封电子邮件。我将能够检索第一个的身体内容,但其他2个说,他们在很大程度上没有任何内容。
78 for mail in emails:
79 # extract body of email
80 content = msgs.get(userId = 'me', id = mail['id'], format =
81 "full").execute()['payload']
82 print()
83 print(content["body"])
84 print()
where emails = service.users()。消息()。列表(userId ='me',q = query).execute()['message']
and q只是过滤器 query =“标签:不需要的消化”
输出看起来像这样:
{'size': 0}
{'size': 44866, 'data':'PCFET0NUWVBFIGh0bWw-DQo8aHRtbCBsYW5nPSJlbiI-DQo8aGVhZD4NCjx0aXRsZT50.........
{'size': 0}
我可以从第二封电子邮件中读取数据,但不能从其他电子邮件中读取数据。这使我感到困惑,因为当我打印出内容的输出[“标题”)时,我会得到这些电子邮件确实存在的证据。
6 Algorithms Every Developer Should Know | Richard Warepam in Dare To Be Better [email protected] Fri, 01 Jul 2022 14:30:00 +0000 (UTC)
The ONLY sustainable sale: Up to 60% off + free shipping thredUP <[email protected]> Fri, 1 Jul 2022 02:44:06 -0700
What makes senior software engineers laugh when they look at a junior engineer's code? Fri, 01 Jul 2022 02:01:31 +0000
这种差异的原因是什么?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在审查了代码的有效载荷后,我们注意到该结构为a Multipart/Digest容器,因此信息列表存储在不同的部分中。
After reviewing the payload of the code, we noticed that the structure was a multipart/digest container, so the information list was stored in a different part.