def test_login_student(self): assert login_student(username, password).id == user_id
def setup_class(self): self.zxw = login_student(username, password) self.exams = self.zxw.get_exams()
from zhixuewang import rewrite_str, login_student import zhixuewang @rewrite_str(zhixuewang.models.Mark) def _(self): score = 0 for subject in self: if subject.subject.name == "语文": score += subject.score * 0.8 elif subject.subject.name == "数学": score += subject.score * 0.7 elif subject.subject.name == "英语": score += subject.score * 0.5 return f"加权后的分数为: {score}" if __name__ == "__main__": zxw = login_student("zx39813588", "SYJ39813588") print(zxw.get_self_mark())
f"# {subject.subject.name} \n", f"分数: {subject.score} \n", ]) return msg def send_mark(mark): r = requests.get(f"https://sc.ftqq.com/{desp}.send", params={ "text": "智学网出成绩了!", "desp": str(mark) }) if not r.ok: time.sleep(5) send_mark(mark) if __name__ == "__main__": with open("user", "r", encoding="utf8") as f: username = f.readline().strip() password = f.readline().strip() desp = f.readline().strip() zxw = login_student(username, password) exam = zxw.get_latest_exam() while True: new_exam = zxw.get_latest_exam() if new_exam != exam: print("已查到成绩!") send_mark(zxw.get_self_mark(new_exam)) time.sleep(60 * 60)
def setup_class(self): self.zxw = login_student(username, password)