前⾔
之前爬12306⽹站的时候,定时检测某⼀车次是否有票,于是想在有票的时候,让程序⾃动发短信通知我。程序代码 ⾸先需要安装twilio库:
pip install twilio
st import Client
account_sid ="AC43977d1bd7451ae26bcbe0efc3ab2309"
auth_token ="5fa5504f415a7db31848d6f9f00051db"
client = Client(account_sid, auth_token)
message = ate(
to="+86178********",#你要发送到的指定⼿机号,这是我的⼿机号,不要打骚扰电话哦! from_="+18035926363",#注册后官⽹给的⼿机号 body="本⽉30号的K353硬座现在有票了!")#发送的内容
运⾏效果
注册账号
account_sid ="AC43977d1bd7451ae26bcbe0efc3ab2309"
auth_token ="5fa5504f415a7db31848d6f9f00051db"
这个account_sid和auth_token是注册后官⽹给的
同时会给你个⼿机号:
from_="+18035926363",