Exemplo n.º 1
0
 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:
         getPassCodeNewOrderAndLogin(session=self.session, imgType="login")
         self.randCode = getRandCode(self.is_auto_code, self.auto_code_type)
         login_num += 1
         self.auth()
         if self.codeCheck():
             uamtk = self.baseLogin(user, passwd)
             if uamtk:
                 self.getUserName(uamtk)
                 break
Exemplo n.º 2
0
 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"]
     self.user, self.passwd = user, passwd
     if not user or not passwd:
         raise UserPasswordException(u"温馨提示: 用户名或者密码为空,请仔细检查")
     # login_num = 0
     while True:
         if not getPassCodeNewOrderAndLogin(session=self.session,
                                            imgType="login"):
             continue
         else:
             # self.check_code()
             break
     pub.subscribe(self.check_code, 'rand_code')
Exemplo n.º 3
0
    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:
            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

# if __name__ == "__main__":
#     # main()
#     # logout()
Exemplo n.º 4
0
    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()
Exemplo n.º 5
0
 def get_code(self):
     "获取验证码"
     getPassCodeNewOrderAndLogin(session=self.session, imgType="login")