2017-05-23 101 views
1
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) 

錯誤彈出:我使用twilio 6.0.2和客戶端不能正常工作

Traceback (most recent call last): File "C:\Users\mediamarkt2\AppData\Local\Programs\Python\Python36-32\sendtext.py", line 1, in from twilio.rest import Client ImportError: cannot import name 'Client'

我使用的是6.0。我究竟做錯了什麼?

+0

是什麼讓你相信twilio安裝在你的Python中? – lit

+0

正如@lit也暗示着,如果你在終端輸入'pip list',你會看到twilio(6.X.X)嗎? – Andy

+0

當我導入twilio並打印出來(twilio .__ version__)沒有錯誤 –

回答

0

Twilio開發者佈道者在這裏。

如果你發現你已經安裝了版本6.3.dev0,那麼你有一個過時的版本恐怕。 6.3.dev0從來沒有正式發佈。

Twilio Python的最新正式版本現在是6.3.0。確保您使用的是其中一個版本,而不是dev0標籤,那麼您的代碼將起作用。

讓我知道這是否有幫助。

相關問題