Exemple #1
0
    def __getNotice__(self):
        raw, res = self.request(branch_num=0, method='GET',
                                url=NOTICE_URL % (time.time() * 1000), max_retry=3)

        text = bytes.decode(raw) if isinstance(raw, bytes) else raw

        try:
            res_json = json.loads(text)
        except json.JSONDecodeError as e:
            llogger.warning(self.user.account, '拉取通知失败。', text)
            raise PullerBasicException(self.user, text, e)

        return res_json
Exemple #2
0
    def add(self, account, password, keys):

        usrop = UserOp(self, account, password, keys)

        if account not in self.members:
            self.members[account] = usrop
            self.queue.append(usrop)
            data = (account, status2str(usrop.getStatus()), u'×', u'○', u'○',
                    u'○')
            gui.frame_main.listctrl_member.Append(data)
            llogger.ok(account, '成员添加成功。')
        else:
            llogger.warning(account, '成员已存在与列表中,请不要重复添加。')

        return usrop
Exemple #3
0
 def UnloginErrorHandler(self):
     llogger.warning(self.user.account,
                     '操作失败:[%s]-"账号已离线,重新登录"。' % self.course, self.msg)
     self.user.op.reInit()
     delayer.timingRun(self.user, self.user.op.login, (0, 0.5), self.msg)
Exemple #4
0
 def LoginExpireErrorHandler(self):
     self.user.op.reInit()
     delayer.timingRun(self.user, self.user.op.login, (0, 0.5), self.msg)
     llogger.warning(self.user.account, '连接已过期,登录失败。', self.msg)
Exemple #5
0
 def VerifyCodeErrorHandler(self):
     self.user.op.reInit()
     delayer.timingRun(self.user, self.user.op.login, (0, 0.5), self.msg)
     llogger.warning(self.user.account, '验证码识别错误,登录失败。', self.msg)
Exemple #6
0
 def UnloginErrorHandler(self):
     llogger.warning(self.user.account, '拉取失败: 账号已离线,重新登录。', self.msg)
     self.user.op.reInit()
     delayer.timingRun(self.user, self.user.op.login, (0, 0.5), self.msg)
Exemple #7
0
 def CourseNotFoundErrorHandler(self):
     llogger.warning(self.user.account,
                     '操作失败:[%s]-"没有开设该课程"。' % self.course, self.msg)
     self.user.op.taker.pullCourses()
     delayer.timingRun(self.user, self.user.op.takeCourse,
                       self.user.delay_range, self.msg)
Exemple #8
0
 def TakingTimeErrorHandler(self):
     llogger.warning(self.user.account,
                     '操作等待:[%s]-"当前不是选课时间"。' % self.course, self.msg)
     self.user.op.onTimingtake()
     delayer.timingRun(self.user, self.user.op.takeCourse,
                       self.user.delay_range, self.msg)
Exemple #9
0
 def ExceedErrorHandler(self):
     llogger.warning(self.user.account,
                     '操作失败:[%s]-"超出选课要求门数"。' % self.course, self.msg)
     self.user.op.done()
Exemple #10
0
 def RepeatErrorHandler(self):
     llogger.warning(self.user.account,
                     '操作失败:[%s]-"已经选了该课程"。' % self.course, self.msg)
     self.user.op.taker.selected.append(self.course)
     delayer.timingRun(self.user, self.user.op.takeCourse, (0, 0.5),
                       self.msg)