python免费发短信

去twilio.com申请账号(只需要验证手机号即可),拿到SID与token,还有active number,后面都要用到

# -*- coding: utf-8 -*-
import time
from twilio.rest import Client
 
text = '信息'
 
auth_token = '************'   #去twilio.com注册账户获取token
account_sid = '*****************'
 
client = Client(account_sid,auth_token)
 
def sent_message(phone_number):
    mes = client.messages.create(
        from_='**********',  #填写在active number处获得的号码 
        body=text,
        to=phone_number
    )
    print("OK")
 
 
while 1:
    sent_message("+86要收到信息的号码")
    time.sleep(3600*24)

这种方法不是很好,虽然免费,但是速度不太好

发布了60 篇原创文章 · 获赞 15 · 访问量 4068

猜你喜欢

转载自blog.csdn.net/qq_15557299/article/details/104184520