小编kar*_*oon的帖子

如何在 Flutter 中获取时区名称?

如何Asia/Calcutta在 Flutter/Dart 中获取当前时区名称?

DateTime.now().timeZoneName获取 String IST
DateTime.now().timeZoneOffset获取 Duration 5:30:00.000000

Intl.DateTimeFormat().resolvedOptions().timeZoneAsia/Calcutta在 JavaScript 中给出所需的结果。

任何帮助表示赞赏。谢谢。

dart flutter

5
推荐指数
1
解决办法
6366
查看次数

Sendgrid 示例不起作用以及如何向多个收件人发送电子邮件?

我已根据代码的要求创建了一个 API 密钥并将其添加到环境中。
以下是我正在使用的代码,并已按照此处提供的步骤进行操作。

# using SendGrid's Python Library
# https://github.com/sendgrid/sendgrid-python
import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail

message = Mail(
    from_email='from_email@example.com',
    to_emails='to@example.com',
    subject='Sending with Twilio SendGrid is Fun',
    html_content='<strong>and easy to do anywhere, even with Python</strong>')
try:
    sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
    response = sg.send(message)
    print(response.status_code)
    print(response.body)
    print(response.headers)
except Exception as e:
    print(e.message)
Run Code Online (Sandbox Code Playgroud)

它抛出这个错误:

Traceback (most recent call last):
File "sendgrid_email.py", line 18, in <module>
    print(e.message)
AttributeError: "ForbiddenError" object has no attribute "message"
Run Code Online (Sandbox Code Playgroud)

打印异常时,它显示 pylint …

python twilio sendgrid

4
推荐指数
1
解决办法
4551
查看次数

标签 统计

dart ×1

flutter ×1

python ×1

sendgrid ×1

twilio ×1