飞信的Python模块 PyWapFetion
jopen 13年前
<p><span style="line-height:20px;font-family:Verdana, Simsun, sans-serif;color:#333333;" class="Apple-style-span">PyWapFetion是一个飞信的Python模块,使用Wap飞信协议。</span></p> <p>Python给手机发短信太不方便了,虽然有个基于电脑客户端协议的PyFetion,但是。。总会在各种时候出现各种验证码,你懂的。。 所以写了这个基于Wap飞信协议的库,免除各种烦恼。</p> <p>示例代码:</p> <div id="LC1" class="line"> <span class="c">#coding=utf-8</span> </div> <div id="LC2" class="line"> <span class="kn">from</span> <span class="nn">PyWapFetion</span> <span class="kn">import</span> <span class="o">*</span> </div> <div id="LC3" class="line"> <span class="n">myfetion</span> <span class="o">=</span> <span class="n">Fetion</span> <span class="p">(</span> <span class="s">'手机号'</span> <span class="p">,</span> <span class="s">'密码'</span> <span class="p">)</span> </div> <div id="LC5" class="line"> <span class="n">myfetion</span> <span class="o">.</span> <span class="n">send2self</span> <span class="p">(</span> <span class="s">'发给自己的东西'</span> <span class="p">)</span> </div> <div id="LC6" class="line"> <span class="n">myfetion</span> <span class="o">.</span> <span class="n">findid</span> <span class="p">(</span> <span class="s">'输入手机号,返回飞信ID'</span> <span class="p">)</span> </div> <div id="LC7" class="line"> <span class="n">myfetion</span> <span class="o">.</span> <span class="n">send2id</span> <span class="p">(</span> <span class="s">'飞信ID'</span> <span class="p">,</span> <span class="s">'消息'</span> <span class="p">)</span> </div> <div id="LC8" class="line"> <span class="n">myfetion</span> <span class="o">.</span> <span class="n">send</span> <span class="p">(</span> <span class="s">'手机号'</span> <span class="p">,</span> <span class="s">'消息'</span> <span class="p">)</span> </div> <div id="LC9" class="line"> <span class="n">myfetion</span> <span class="o">.</span> <span class="n">addfriend</span> <span class="p">(</span> <span class="s">'手机号'</span> <span class="p">,</span> <span class="s">'你的昵称(5字以内)'</span> <span class="p">)</span> </div> <div id="LC10" class="line"> <span class="n">myfetion</span> <span class="o">.</span> <span class="n">send</span> <span class="p">([</span> <span class="s">'手机号1'</span> <span class="p">,</span> <span class="s">'手机号2'</span> <span class="p">,</span> <span class="s">'这就是传说中的群发'</span> <span class="p">],</span> <span class="s">'消息'</span> <span class="p">)</span> </div> <div id="LC11" class="line"> <span class="c">#成功返回True,失败返回False</span> </div> <div id="LC13" class="line"> <span class="n">myfetion</span> <span class="o">.</span> <span class="n">logout</span> <span class="p">()</span> </div> <div id="LC14" class="line"> <span class="c">#----------------------------------------------------------------------</span> </div> <div id="LC15" class="line"> <span class="n">send2self</span> <span class="p">(</span> <span class="s">'手机号'</span> <span class="p">,</span> <span class="s">'密码'</span> <span class="p">,</span> <span class="s">'信息'</span> <span class="p">)</span> </div> <div id="LC16" class="line"> <span class="n">send</span> <span class="p">(</span> <span class="s">'手机号'</span> <span class="p">,</span> <span class="s">'密码'</span> <span class="p">,</span> <span class="s">'接收方手机号'</span> <span class="p">,</span> <span class="s">'信息'</span> <span class="p">)<br /> <br /> 项目地址:<a href="/misc/goto?guid=4958200210924420348" target="_blank">https://github.com/whtsky/PyWapFetion</a></span> </div>