- 简单的来说 就是使用twilio去实现自动发送短信功能
- 需要先申请account_sid和auth_token
- 申请网址在这
https://www.twilio.com/
- 好处在于免费,坏处在于需要手机验证 这比较麻烦
- 然后安装twilio库
- 命令行
pip install twilio
即可 - 最后是简单的调用 如下:
#短信模块
from twilio.rest import Client
account_sid = 'xxxx'
auth_token ='xxxx'
client = Client(account_sid,auth_token)
message = client.messages.create(
from_='+12109780784',
body='hello world',
to='+8611232323'
)
print(message.sid)