twilio API的短信通知



大家晚上好我必须在我的django项目中实现twilio模块,它工作得很好,问题是它不允许你发送短信到我以外的电话号码

我认为示例代码如下所示。需要设置TWILIO_ACCOUNT_SIDTWILIO_AUTH_TOKEN两个环境变量

import os
from twilio.rest import Client
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)
message = client.messages.create(
body="your message",
from_='+15017122661',
to='+15558675310'
)
print(message.sid)

最新更新