【发布时间】:2021-05-02 04:55:09
【问题描述】:
我搜索了类似的问题,但找不到令人满意的答案。 这是我用来从我的 Twilio 验证号码向我注册的手机号码发送消息的 python sn-p:
account_sid = ['AC02ba1e07c83130f76679f2f334160fba']
auth_token = ['*******************************']
client = Client(account_sid,auth_token)
message = client.messages \
.create(
body=sent,
from_='my_twilio_mobile_number',
to='my_reg_mobile_number'
)
print(message.sid)
执行时出现以下错误:
Traceback (most recent call last):
File "/Users/ameeteshsharma/Documents/covax/avail.py", line 59, in <module>
message = client.messages \
File "/usr/local/lib/python3.9/site-packages/twilio/rest/api/v2010/account/message/__init__.py", line 88, in create
payload = self._version.create(method='POST', uri=self._uri, data=data, )
File "/usr/local/lib/python3.9/site-packages/twilio/base/version.py", line 205, in create
raise self.exception(method, uri, response, 'Unable to create record')
twilio.base.exceptions.TwilioRestException:
HTTP Error Your request was:
POST /Accounts/['AC02ba1e07c83130f76679f2f334160fba']/Messages.json
Twilio returned the following information:
Unable to create record: The requested resource /2010-04-01/Accounts/['AC02ba1e07c83130f76679f2f334160fba']/Messages.json was not found
More information may be available here:
https://www.twilio.com/docs/errors/20404
我尝试查看上述文档,但找不到合理的解决方案。 account_sid 和 auth_token 都是正确的。我该如何处理?
【问题讨论】:
标签: python twilio twilio-api