简体   繁体   English

如何运行twilio程序?

[英]How to run twilio programs?

I am running this code which is giving error : 我正在运行此代码,它给出了错误:

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

on running it gives the following error: 在运行它会给出以下错误:

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

and then run the code 然后运行代码

try to upgrade the twillio to latest version and use the following code 尝试将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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM