def main(): log=qqlib.initLogging() nownum = 0 lastuid = '' getnum = 0 start = clock() if os.name == 'nt': qq_id=int(raw_input('请输入你的QQ号码:'.decode('utf-8').encode("cp936"))) pwd=getpass.getpass('请输入你的QQ密码:'.decode('utf-8').encode("cp936")) else: qq_id=int(raw_input('请输入你的QQ号码:')) pwd=raw_input('请输入你的QQ密码:') qq_user=qqlib.qq(qq_id,pwd,log) try: reactor.listenUDP(0, ConsoleProtocol(qq_user)) log.info ('Python-QQ开始运行') except Exception,ex: log.error(ex)
def main(): log = qqlib.initLogging() nownum = 0 lastuid = '' getnum = 0 start = clock() if os.name == 'nt': qq_id = int(raw_input('请输入你的QQ号码:'.decode('utf-8').encode("cp936"))) pwd = getpass.getpass('请输入你的QQ密码:'.decode('utf-8').encode("cp936")) else: qq_id = int(raw_input('请输入你的QQ号码:')) pwd = raw_input('请输入你的QQ密码:') qq_user = qqlib.qq(qq_id, pwd, log) try: reactor.listenUDP(0, ConsoleProtocol(qq_user)) log.info('Python-QQ开始运行') except Exception, ex: log.error(ex)
def login(): id=int(qq_id.get()) pwd=qq_pwd.get() qq_user=qqlib.qq(id,pwd,log,conn) protocol=ConsoleProtocol(qq_user) log.info ('Python-QQ开始运行') protocol.pre_login() threads.append(qqrecv(protocol)) threads.append(qqalive(protocol)) threads.append(qqinput(protocol)) for t in threads: t.start() for t in threads: t.join() log.error('程序运行结束或失败,如有异常情况请和作者联系。') log.info( "收到 %d 条", getnum) log.info("用时:%.2f 秒", (clock()-start)) log.info("每秒:%f条", (nownum / (clock()-start)))
def main(): log=qqlib.initLogging() nownum = 0 lastuid = '' getnum = 0 start = clock() conn=socket(AF_INET, SOCK_DGRAM) conn.settimeout(60) threads=[] if os.name == 'nt': qq_id=int(raw_input('请输入你的QQ号码:'.decode('utf-8').encode("cp936"))) pwd=getpass.getpass('请输入你的QQ密码:'.decode('utf-8').encode("cp936")) else: qq_id=int(raw_input('请输入你的QQ号码:')) pwd=getpass.getpass('请输入你的QQ密码:') qq_user=qqlib.qq(qq_id,pwd,log,conn) protocol=ConsoleProtocol(qq_user) try: log.info ('Python-QQ开始运行') protocol.pre_login() except Exception,ex: log.error(ex)
def Login(self, event) : dlg = LoginDialog(self, -1, u"Python-QQ登录窗口", size=(350, 200), #style = wxCAPTION | wxSYSTEM_MENU | wxTHICK_FRAME style = wx.DEFAULT_DIALOG_STYLE ) dlg.CenterOnScreen() # this does not return until the dialog is closed. val = dlg.ShowModal() if val == wx.ID_OK: qid = int(dlg.qid.GetValue().strip()) pwd = dlg.pwd.GetValue().strip() self.qq = qqlib.qq(qid, pwd, self.log) self.conn = GuiProtocol(self.qq) reactor.listenUDP(0, self.conn) self.log.info("Python-QQ starts") self.conn.login() reactor.callLater(1,self.test) self.log.info("login success") dlg.Destroy()