Ejemplo n.º 1
0
 def get_username(self):
     username = utils.get_account()['username']
     if username:
         return username
     else:
         username = raw_input('请输入账号:')
         utils.set_account(username=username)
     return username
Ejemplo n.º 2
0
 def get_password(self):
     username = utils.get_account()['username']
     password = utils.get_account()['password']
     if username and password:
         return password
     else:
         password = raw_input('请输入密码:')
         utils.set_account(password=password)
     return password
Ejemplo n.º 3
0
 def parse_login(self, response):
     errno = int(re.search(r'err_no=(\d+)', response.text).group(1))
     self.__code_string = re.search(r'&codeString=(.*?)&', response.body).group(1)
     if errno == 0:
         self.__password = None
         utils.debug('登录成功')
         for request in self.parse_login_success(response):
             yield request
     else:
         utils.debug(get_login_err_msg(errno, response.body))
     if errno == 1 or errno == 2 or errno == 4 or errno == 53 or errno == 58:
         if errno == 1 or errno == 2 or errno == 53 or errno == 58:
             self.__username = None
             utils.set_account(username='')
         self.__password = None
         utils.set_account(password='')
         yield self.__login(self.__code_string)
     elif errno == 6 or errno == 257:
         yield self.__get_captcha(self.__code_string)
     else:
         self.__username = None
         self.__password = None