发送短信

要使用 Twilio 和 Python 发送第一条 SMS,你只需要使用 Twilio-Python 帮助程序库即可开始使用。

# Download the twilio-python library from http://twilio.com/docs/libraries
from twilio.rest import TwilioRestClient
 
# Find these values at https://twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXX"
auth_token = "YYYYYYYYYYYYYYYYYY"
client = TwilioRestClient(account_sid, auth_token)
 
message = client.messages.create(to="+12316851234", from_="TWILIO_NUMBER",
                                 body="Hello there, StackOverflow!")