[英]How to run twilio programs?
我正在運行此代碼,它給出了錯誤:
from twilio.rest import TwilioRestClient
account_sid="AC9d3b9e6da765********************"
auth_token="5c6ff9b2e2dc********************"
client= TwilioRestClient(account_sid , auth_token)
message = client.sms.message.create(
body="This is Deadshot",
to="+919582******",
from_="+91987*******")
print message.sid
在運行它會給出以下錯誤:
Traceback (most recent call last):
File "C:\Python27\myFiles\twilio_demo.py", line 4, in <module>
from twilio.rest import TwilioRestClient
File "C:\Python27\lib\site-packages\twilio-6.3.0-py2.7.egg\twilio\rest\__init__.py", line 12, in <module>
from twilio.base.exceptions import TwilioException
File "C:\Python27\lib\site-packages\twilio-6.3.0-py2.7.egg\twilio\base\exceptions.py", line 4, in <module>
from six import u
ImportError: No module named six
pip install six
pip install requests
pip install pytz
然后運行代碼
嘗試將twillio升級到最新版本並使用以下代碼
from twilio.rest import Client
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
message = client.messages.create(
to="",
from_="",
body="Hello from Python!")
print(message.sid)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.