此代码应该发送短信
from twilio.rest import Client
# Your Account SID from twilio.com/console
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
# Your Auth Token from twilio.com/console
auth_token = ""XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX""
client = Client(account_sid, auth_token)
message = client.messages.create(
to="####",
from_="####",
body="Hello from Python!")
print(message.sid)
当我尝试它时,它总是会出现这个错误:
Traceback (most recent call last):
File "G:\OOP\send_text.py", line 1, in <module>
from twilio.rest import Client
File "G:\OOP\twilio.py", line 3
easy_install twilio
^
SyntaxError: invalid syntax
任何人都可以解释原因吗? 提前谢谢。