python使用PyFetion来发送短信的例子
程序员文章站
2023-11-11 20:11:04
通过pyfetion可以很方便的使用python来用飞信发送短信,下面贴出代码:复制代码 代码如下:from fetion import *import osdef sen...
通过pyfetion可以很方便的使用python来用飞信发送短信,下面贴出代码:
复制代码 代码如下:
from fetion import *
import os
def sendsms(sms):
myphone = 'xxxxxx'
mypwd = 'oooooooooo'
tophone = 'oxoxoxoxoxox'
fetion = pyfetion(myphone,mypwd,'tcp')
fetion.login(fetionhidden)
print 'send to '+tophone
fetion.send_sms(sms,tophone,true)
print 'ok'
fetion.logout()
return true
msg = "hello world"
sendsms(msg)
print 'ok!!!'
有时会提醒你输入验证码,验证码就在pyfetion生成的一个图片中,查看图片然后输入验证码就ok了.
pyfetion项目主页:https://code.google.com/p/pytool/