我使用Twilio运行了发送文本的示例代码,代码来自:https://www.twilio.com/docs/libraries/python 我的代码是:
from twilio.rest import TwilioRestClient, 
account_sid = "{{ Account 510 from www.twilio.com/console }}"
auth_token = "{{ Auth Token from www.twilio.com/console  }}"
client = TwilioRestClient(account_sid, auth_token) 
message = clientmessages.create(body="You are the best!", 
                                to="your phone number",  
                                from_="your Twilio number") 
print(message.sid) 
我已经安装了twilio,使用pip,为什么会出现这个问题,请帮忙〜我的代码有一份副本:
from twilio.rest import TwilioRestClient;
account_sid = "{{ ACCOUNT_SID }}" # Your Account SID from www.twilio.com/console
auth_token  = "{{ AUTH_TOKEN }}"  # Your Auth Token from www.twilio.com/console
client = TwilioRestClient(account_sid, auth_token)
message = client.messages.create(body="You are the best!",
    to="+phonenumber",    # Replace with your phone number
    from_="+(201) ") # Replace with your Twilio number
print(message.sid)
phi*_*ash 22
Twilio开发者传道者在这里.
我知道你已经通过将库的版本从6.0更改为5.6.0来回答自己,但这就是提醒我实际问题的原因!
当使用Twilio Python的助手库 6.0版,您需要导入Client不TwilioRestClient.
我想知道你是否有文档集来显示5.6.0库示例.如果您想使用6.0(您应该使用它是最新的),请确保您在文档中选择了最新版本.请参阅下图,了解如何选择它.
| 归档时间: | 
 | 
| 查看次数: | 11976 次 | 
| 最近记录: |