def go_login(self): """ 登陆 :param user: 账户名 :param passwd: 密码 :return: """ #user, passwd = TickerConfig.USER, TickerConfig.PWD user = input("请输入您的12306账号:") passwd = getpass.getpass("请输入密码:") if not user or not passwd: raise UserPasswordException(u"温馨提示: 用户名或者密码为空,请仔细检查") login_num = 0 while True: if loginConf(self.session): # self.auth() result = getPassCodeNewOrderAndLogin1(session=self.session, imgType="login") if not result: continue self.randCode = getRandCode(self.is_auto_code, self.auto_code_type, result) print(self.randCode) login_num += 1 self.auth() if self.codeCheck(): uamtk = self.baseLogin(user, passwd) if uamtk: self.getUserName(uamtk) break else: loginAysnSuggest(self.session, username=user, password=passwd) login_num += 1 break
def go_login(self): """ 登陆 :param user: 账户名 :param passwd: 密码 :return: """ # if self.is_auto_code and self.auto_code_type == 1: # balance = DamatuApi(_get_yaml()["auto_code_account"]["user"], _get_yaml()["auto_code_account"]["pwd"]).getBalance() # if int(balance) < 40: # raise balanceException(u'余额不足,当前余额为: {}'.format(balance)) user, passwd = _get_yaml()["set"]["12306account"][0][ "user"], _get_yaml()["set"]["12306account"][1]["pwd"] if not user or not passwd: raise UserPasswordException(u"温馨提示: 用户名或者密码为空,请仔细检查") login_num = 0 while True: if loginConf(self.session): # result = getPassCodeNewOrderAndLogin(session=self.session, imgType="login") self.auth() devicesIdUrl = copy.deepcopy(self.session.urls["getDevicesId"]) devicesIdUrl["req_url"] = devicesIdUrl["req_url"].format( int(time.time() * 1000)) devicesIdRsp = self.session.httpClint.send(devicesIdUrl) devicesId = eval( devicesIdRsp.split("(")[1].split(")")[0].replace( "'", ""))["dfp"] if devicesId: self.session.httpClint.set_cookies(RAIL_DEVICEID=devicesId) result = getPassCodeNewOrderAndLogin1(session=self.session, imgType="login") if not result: continue self.randCode = getRandCode(self.is_auto_code, self.auto_code_type, result) login_num += 1 self.auth() if self.codeCheck(): uamtk = self.baseLogin(user, passwd) if uamtk: self.getUserName(uamtk) break else: loginAysnSuggest(self.session, username=user, password=passwd) login_num += 1 break # if __name__ == "__main__": # # main() # # logout()
def go_login(self): """ 登陆 :param user: 账户名 :param passwd: 密码 :return: """ user, passwd = _get_yaml()["set"]["12306account"][0][ "user"], _get_yaml()["set"]["12306account"][1]["pwd"] if not user or not passwd: raise UserPasswordException(u"温馨提示: 用户名或者密码为空,请仔细检查") login_num = 0 while True: if loginConf(self.session): self.auth() devicesIdUrl = copy.deepcopy(self.session.urls["getDevicesId"]) devicesIdUrl["req_url"] = devicesIdUrl["req_url"].format( int(time.time() * 1000)) # devicesIdRsp = self.session.httpClint.send(devicesIdUrl) # devicesId = eval(devicesIdRsp.split("(")[1].split(")")[0].replace("'", ""))["dfp"] devicesId = "UysLb2cYwsVjyInSzZ0pGOmYplvokmhBjoGNjrinquaUD0id7gkifgF6FvM2TRCL7Df89GZL1lVV763tGhiPhxlNdlE7iQkk496KUGCFZyyWxE4d0XjyHYv9DlsXfKTlrd8RBUdYIYjmWBXWMN65ElDQiO_Rnrul" if devicesId: self.session.httpClint.set_cookies(RAIL_DEVICEID=devicesId) result = getPassCodeNewOrderAndLogin1(session=self.session, imgType="login") if not result: continue self.randCode = getRandCode(self.is_auto_code, self.auto_code_type, result) print(self.randCode) login_num += 1 self.auth() if self.codeCheck(): uamtk = self.baseLogin(user, passwd) if uamtk: self.getUserName(uamtk) break else: loginAysnSuggest(self.session, username=user, password=passwd) login_num += 1 break
def go_login(self): """ 登陆 :param user: 账户名 :param passwd: 密码 :return: """ user, passwd = TickerConfig.USER, TickerConfig.PWD if not user or not passwd: raise UserPasswordException(u"温馨提示: 用户名或者密码为空,请仔细检查") login_num = 0 while True: uamtk = self.baseLogin(user, passwd) if uamtk: self.getUserName(uamtk) break else: loginAysnSuggest(self.session, username=user, password=passwd) login_num += 1 break
def go_login(self): """ 登陆 :param user: 账户名 :param passwd: 密码 :return: """ # if self.is_auto_code and self.auto_code_type == 1: # balance = DamatuApi(_get_yaml()["auto_code_account"]["user"], _get_yaml()["auto_code_account"]["pwd"]).getBalance() # if int(balance) < 40: # raise balanceException(u'余额不足,当前余额为: {}'.format(balance)) user, passwd = _get_yaml()["set"]["12306account"][0]["user"], _get_yaml()["set"]["12306account"][1]["pwd"] if not user or not passwd: raise UserPasswordException(u"温馨提示: 用户名或者密码为空,请仔细检查") login_num = 0 while True: if loginConf(self.session): result = getPassCodeNewOrderAndLogin(session=self.session, imgType="login") if not result: continue self.randCode = getRandCode(self.is_auto_code, self.auto_code_type, result) login_num += 1 self.auth() if self.codeCheck(): uamtk = self.baseLogin(user, passwd) if uamtk: self.getUserName(uamtk) break else: loginAysnSuggest(self.session, username=user, password=passwd) login_num += 1 break # if __name__ == "__main__": # # main() # # logout()