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
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
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)
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)
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)
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)
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)
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)
def ExceedErrorHandler(self): llogger.warning(self.user.account, '操作失败:[%s]-"超出选课要求门数"。' % self.course, self.msg) self.user.op.done()
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)