def get_code(self): ''' 获取验证信息 :return: ''' getCodethread = myThread.GetCodePicThread(self,self.myHttpRequest,constant.USERNAME) getCodethread.start()
def OnKillFocus(self,e): try: constant.USERNAME = int(self.tidInput.GetValue()) except ValueError: pass; getCodethread = myThread.GetCodePicThread(self,self.myHttpRequest,constant.USERNAME) getCodethread.start() e.Skip()
def loginQQ(self, e): try: configFile = open('Mfkp_config.ini', 'r') mystr = configFile.readline() if str(constant.USERNAME) in mystr: constant.COLLECTTHEMEID = int( configFile.readline().split('=')[1]) constant.STEALFRIEND = int(configFile.readline().split('=')[1]) constant.QQSHOWSELECT = int( configFile.readline().split('=')[1]) constant.QQSHOWID = int(configFile.readline().split('=')[1]) configFile.close() except Exception: print 'file can not find' verifysession = '' if self.codeInput.IsShown(): code = str(self.codeInput.GetValue()) for ck in self.myHttpRequest.cj: if ck.name == 'verifysession': verifysession = ck.value else: code = str(constant.CODE) verifysession = str(constant.SESSION) constant.PASSWORD = str(self.aidInput.GetValue()) password = Tea.getTEAPass(constant.USERNAME, constant.PASSWORD, code) base_url = constant.LOGINURL base_url = base_url.replace('USERNAME', str(constant.USERNAME)) base_url = base_url.replace('VERIFYSESSION', verifysession) base_url = base_url.replace('PASSWORD', password) base_url = base_url.replace('CODE', code) page_content = self.myHttpRequest.get_response(base_url) result = page_content.read() if str(constant.USERNAME) in result: dlg = wx.MessageDialog(self, u"密码或验证码不正确", caption=u'提示', style=wx.OK, pos=wx.DefaultPosition) retCode = dlg.ShowModal() if retCode == wx.ID_OK: dlg.Destroy() getCodethread = myThread.GetCodePicThread(self, self.myHttpRequest, constant.USERNAME) getCodethread.start() else: self.Destroy() main.Main(None, u'魔法卡片', self.myHttpRequest, self.database, self.cur_file_dir())
def loginQQ(self,e): config = ConfigParser.ConfigParser() try: config.read('Mfkp_config.ini') constant.REFINEDTYPE = int(config.get('userconfig','refinedtype')) constant.COLLECTTHEMEID = int(config.get('userconfig','themeid')) constant.COLLECTTHEMEID2 = int(config.get('userconfig','themeid2')) constant.STEALFRIEND = int(config.get('userconfig','friendid')) constant.QQSHOWSELECT = int(config.get('userconfig','qqshow')) constant.QQSHOWID = int(config.get('userconfig','qqshowid')) constant.QQSHOWSELECT2 = int(config.get('userconfig','qqshow2')) constant.QQSHOWID2 = int(config.get('userconfig','qqshowid2')) try: constant.STEALFRIEND2 = int(config.get('userconfig','friendid2')) except : pass except Exception: print 'file can not find' verifysession = '' if self.codeInput.IsShown(): code = str(self.codeInput.GetValue()) for ck in self.myHttpRequest.cj: if ck.name=='verifysession': verifysession = ck.value else: code = str(constant.CODE) verifysession = str(constant.SESSION) constant.PASSWORD = str(self.aidInput.GetValue()) password = Tea.getTEAPass(constant.USERNAME,constant.PASSWORD,code) base_url = constant.QQLOGINURL base_url = base_url.replace('USERNAME', str(constant.USERNAME)) base_url = base_url.replace('VERIFYSESSION', verifysession) base_url = base_url.replace('PASSWORD',password) base_url = base_url.replace('CODE',code.encode('utf-8')) page_content = self.myHttpRequest.get_response(base_url).read().decode('utf-8') try: print page_content except: pass if u'登录成功' not in page_content: dlg = wx.MessageDialog(self,u"密码或验证码不正确",caption=u'提示',style=wx.OK,pos=wx.DefaultPosition) retCode = dlg.ShowModal() if retCode == wx.ID_OK: dlg.Destroy() getCodethread = myThread.GetCodePicThread(self,self.myHttpRequest,constant.USERNAME) getCodethread.start() else: isFriend = self.getUserList() if isFriend: sid = re.findall('sid=(.*?)\'',page_content,re.S) print sid constant.SID = sid[0] '''下来是如果是红钻的情况下领取奖励 ''' base_url = self.getUrl(constant.DAILYURL) postData = { 'uin':constant.USERNAME, 'type':1 } page_content = self.myHttpRequest.get_response(base_url,postData) print page_content.read() self.Destroy() main.Main(None,u'熊熊助手-'+str(constant.USERNAME),self.myHttpRequest,self.loginCard(),self.database) else: dlg = wx.MessageDialog(self,u"对不起你没有权限登陆",caption=u'提示',style=wx.OK,pos=wx.DefaultPosition) retCode = dlg.ShowModal() if retCode == wx.ID_OK: dlg.Destroy()