Exemple #1
0
def init_model():
    llogger.normal('NULL', '开始加载验证码识别模型。')
    try:
        captcha.killer.init()
    except:
        llogger.error('NULL', '识别模型加载失败。')
    else:
        llogger.ok('NULL', '识别模型加载成功。')
Exemple #2
0
 def __init__(self, req_kwargs):
     self.req_kwargs = req_kwargs
     if req_kwargs.get('user'):
         llogger.error(
             req_kwargs.get('user').account, 'Urllib请求超时。',
             req_kwargs.get('msg', ''))
     else:
         llogger.error('NULL', 'Urllib请求超时。', req_kwargs.get('msg', ''))
Exemple #3
0
 def verify(self):
     self.user.status = Pool.VERIFYING
     self.taker.puller.pullSelected()
     targets = self.taker.getTargets()
     if targets:
         tar_str = ''
         for i in targets:
             tar_str += '[%s]' % i.__str__()
         llogger.error(self.user.account, '以下目标未成功: {%s}' % tar_str)
         self.fail()
     else:
         self.done()
Exemple #4
0
    def postCancel(self, course):
        llogger.normal(self.user.account, '开始退选: [%s]' % course.__str__())

        data = {
            'jxbdm': course.jxbdm,
            'kcrwdm': course.kcrwdm,
            'kcmc': course.kcmc

        }

        raw, res = self.request(url=CANCEL_COURSE_URL, data=data, method='POST', branch_num=0, max_retry=3)
        text = bytes.decode(raw) if isinstance(raw, bytes) else raw
        try:
            if int(text) > 0:
                llogger.ok(self.user.account, '退选成功: [%s]' % course.__str__(), text)
                return True
            else:
                llogger.error(self.user.account, '退选失败: [%s]' % course.__str__(), text)
                return False
        except ValueError as e:
            raise TakerBasicException(self.user, text, e)
Exemple #5
0
 def fail(self):
     self.user.status = Pool.FAILURE
     self.cancelGetNotice()
     llogger.error(self.user.account, '任务失败,停止工作。成功选取[%d]项' % self.user.success_counter)
Exemple #6
0
    def UnknownErrorHandler(self):

        print('UnknownError in LoginBasicException: ', self.msg)
        llogger.error(self.user.account, '登录发生未知错误。', self.msg)
Exemple #7
0
 def UserValueErrorHandler(self):
     self.user.op.reInit()
     self.user.op.fail()
     llogger.error(self.user.account, '帐号或密码不正确,登录失败中止。', self.msg)
Exemple #8
0
 def UnknownErrorHandler(self):
     print('UnknownError in TakerBasicException: ', self.msg)
     llogger.error(self.user.account, '操作发生未知信息。', self.msg)