项目地址:https://code.google.com/p/pytool/
以上是项目主页,通过PyFetion可以很方便的使用python来用飞信发送短信。
完整代码:
#author:liangliang
#email:liangliangyy@gmail.com
#blog:http://www.lylinux.org/
#site: www.jb200.com
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生成的一个图片中,查看图片然后输入验证码就可以了。