【问题标题】:SendGrid -> TypeError: cannot concatenate 'str' and 'NoneType' objectsSendGrid -> TypeError:无法连接“str”和“NoneType”对象
【发布时间】:2016-05-04 02:38:23
【问题描述】:

我对此很陌生,但我基本上直接从 github 复制了示例并得到了错误:TypeError: cannot concatenate 'str' and 'NoneType' objects。我相信我正确设置了环境变量,只是不确定我缺少什么。感谢您的帮助。

import sendgrid
import os

sg = sendgrid.SendGridClient(os.environ.get('SENDGRID_API_KEY'))

message = sendgrid.Mail()
message.add_to('Recip <redacted@gmail.com>')
message.set_subject('Example')
message.set_html('Body')
message.set_text('Body')
message.set_from('Sender <redacted@gmail.com>')
status, msg = sg.send(message)
print(status, msg)

【问题讨论】:

  • 你能显示完整的回溯吗?

标签: python email sendgrid


【解决方案1】:

不知道真正的问题是什么,但删除 API 密钥并生成一个新密钥会立即修复它。谢谢各位!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多