def default_get(self, cr, uid, fields, context=None): result = super(fetion, self).default_get(cr, uid, fields, context=context) config_parameter_obj = self.pool.get("ir.config_parameter") fetion_username = config_parameter_obj.get_param(cr, uid, "fetion", context=context) key = config_parameter_obj.get_param(cr, uid, "key", context=context) global myfetion try: myfetion = Fetion(fetion_username, key) except: return result print myfetion return result
def checkmessage(Fetion): while True: for x,y,z in Fetion.getmessage(): printl('') printl('%s发来信息:%s' % (y,z)) Fetion.markread(x)
Phone = raw_input('') if Phone is '' or Phone.isdigit() is False or len(Phone) is not 11: printl('手机号错误。',False) exit() printl('请输入密码:(不回显)',False) Password = getpass('') printl('''请选择登录状态: 1:在线 2:忙碌 3:离开 4:隐身 输入其他字符默认为隐身''') Status = raw_input() Status = '4' if Status is '' or (Status.isdigit() and 0<int(2)<5) else Stauts try: User = Fetion(Phone,Password,Status) except: printl('用户名或密码错误。') exit() clear() start_new_thread(checkmessage,(User,)) printl(__help__) while True: command = raw_input('Fetion>').split() if len(command) == 0: pass elif command[0] == 'help' : printl(__help__) elif command[0] == 'cls' :
def checkmessage(Fetion): while True: for x, y, z in Fetion.getmessage(): printl('') printl('%s发来信息:%s' % (y, z)) Fetion.markread(x)
if Phone is '' or Phone.isdigit() is False or len(Phone) is not 11: printl('手机号错误。', False) exit() printl('请输入密码:(不回显)', False) Password = getpass('') printl('''请选择登录状态: 1:在线 2:忙碌 3:离开 4:隐身 输入其他字符默认为隐身''') Status = raw_input() Status = '4' if Status is '' or (Status.isdigit() and 0 < int(2) < 5) else Stauts try: User = Fetion(Phone, Password, Status) except: printl('用户名或密码错误。') exit() clear() start_new_thread(checkmessage, (User, )) printl(__help__) while True: command = raw_input('Fetion>').split() if len(command) == 0: pass elif command[0] == 'help': printl(__help__) elif command[0] == 'cls':
# coding=utf-8 from __future__ import with_statement from PyWapFetion import Fetion, send2self, send # 仅作参考,详细了解请参考源码 # 快速发送: send2self('手机号', '密码', '信息') send('手机号', '密码', '接收方手机号', '信息') #---------------------------------------------------------------------- myfetion = Fetion('手机号', '密码') myfetion.changestatus('0') # 改变在线状态 myfetion.send2self('发给自己的东西') myfetion.findid('输入手机号,返回飞信ID') myfetion.sendBYid('飞信ID', '消息') myfetion.send('手机号', '消息', sm=True) # 发送飞信信息 # 通过设定sm=True强制发送短信(sm=ShortMessage) myfetion.send('昵称', '消息') # 你也可以这么干 myfetion.addfriend('手机号', '你的昵称(5字以内)') myfetion.send(['手机号1', '手机号2', '这就是传说中的群发'], '消息') # 成功返回True,失败返回False myfetion.send2self('这个是发给自己的定时短信', time='201111201120') '''发送定时短信。格式:年月日小时分钟 如:2011年11月20日11时14分:201111201144 2012年11月11日11时11分:201211111111 注意:时间允许范围:当前时刻向后10分钟-向后1年 如:当前时间:2011年11月20日 11:17
# coding=utf-8 from __future__ import with_statement from PyWapFetion import Fetion, send2self, send #仅作参考,详细了解请参考源码 #快速发送: send2self('手机号', '密码', '信息') send('手机号', '密码', '接收方手机号', '信息') #---------------------------------------------------------------------- myfetion = Fetion('手机号', '密码') myfetion = Fetion('手机号', '密码') myfetion.changestatus('0') # 改变在线状态 myfetion.send2self('发给自己的东西') myfetion.findid('输入手机号,返回飞信ID') myfetion.sendBYid('飞信ID', '消息') myfetion.send('手机号', '消息', sm=True) # 发送飞信信息 #通过设定sm=True强制发送短信(sm=ShortMessage) myfetion.send('昵称', '消息') # 你也可以这么干 myfetion.addfriend('手机号', '你的昵称(5字以内)') myfetion.send(['手机号1', '手机号2', '这就是传说中的群发'], '消息') # 成功返回True,失败返回False myfetion.send2self('这个是发给自己的定时短信', time='201111201120') '''发送定时短信。格式:年月日小时分钟 如:2011年11月20日11时14分:201111201144 2012年11月11日11时11分:201211111111 注意:时间允许范围:当前时刻向后10分钟-向后1年