Home > Backend Development > Python Tutorial > python使用PyFetion来发送短信的例子

python使用PyFetion来发送短信的例子

WBOY
Release: 2016-06-16 08:44:29
Original
1306 people have browsed it

通过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/

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template