Python短信电话报警

sid 和token 需要自己去https://www.twilio.com/try-twilio注册twilio 账号申请是免费的  from后面的电话也是官方提供的

直接看脚本

# -*-conding: -*-utf8
from twilio.rest import Client
#twilio 公司发送短信试用版
# Your Account SID from twilio.com/console
account_sid = "***********"      
# Your Auth Token from twilio.com/console
auth_token = "****************************"

client = Client(account_sid, auth_token)

message = client.messages.create(
to="+8618534342346",
from_="+14243342342",
body="Hello from Python!")
#电话
# call = client.calls.create(
# to="+86184243242342436",
# from_="+1201842423423062",
# url="https://demo.twilio.com/welcome/voice/voice.xml"
# )
#
# print(call.sid)
print(message.sid)
~

posted @ 2019-09-16 16:33  来自牧羊人  阅读(750)  评论(0编辑  收藏  举报