我使用twilio 6.0.2并且客户端无法正常工作

时间:2017-05-23 18:42:54

标签: python twilio

from twilio.rest import Client

# Your Account SID from twilio.com/console
account_sid = "`enter code here`"
# Your Auth Token from twilio.com/console
auth_token  = "`enter code here`"

client = Client(account_sid, auth_token)

message = client.messages.create(
    to="`enter code here`", 
    from_="`enter code here`",
    body="Hello from Python!")

print(message.sid)

弹出错误:

  

Traceback(最近一次调用最后一次):文件   " C:\用户\ mediamarkt2 \应用程序数据\本地\程序\的Python \ Python36-32 \ sendtext.py&#34 ;,   第1行,in       来自twilio.rest import客户端ImportError:无法导入名称'客户端'

我使用的是6.0。我做错了什么?

1 个答案:

答案 0 :(得分:0)

Twilio开发者传道者在这里。

如果你发现你已经安装了6.3.dev0版本,那么你恐怕会有一个过时的版本。 6.3.dev0从未正式发布。

Twilio Python的最新官方发布版现为6.3.0。确保您使用的是其中一个版本,而不是dev0标记,那么您的代码就可以使用。

让我知道这是否有帮助。