clean debug info

This commit is contained in:
2025-07-06 14:54:43 +08:00
parent 7f512b145c
commit 6e9704a803

10
main.py
View File

@ -200,7 +200,7 @@ class Lessons:
html = res.text html = res.text
match = re.search(r"fajhh=(\d+)", html) match = re.search(r"fajhh=(\d+)", html)
if not match: if not match:
print(html) # print(html)
raise LessonsException("未找到培养方案编号") raise LessonsException("未找到培养方案编号")
self.fajhh = match.group(1) self.fajhh = match.group(1)
@ -227,7 +227,7 @@ class Lessons:
if not self.term: if not self.term:
raise LessonsException("未找到学期信息") raise LessonsException("未找到学期信息")
print(self.fajhh, self.term) # print(self.fajhh, self.term)
def read_lessons(self) -> List[tuple[str, str, str]]: def read_lessons(self) -> List[tuple[str, str, str]]:
classes = [] classes = []
@ -285,7 +285,7 @@ class Lessons:
for item in cls: for item in cls:
if item["classNum"] in cl[1]: if item["classNum"] in cl[1]:
print(item["classNum"],type(item["classNum"])) # print(item["classNum"],type(item["classNum"]))
if item["kcm"] != cl[2]: if item["kcm"] != cl[2]:
logger.critical( logger.critical(
f"课程 {cl[2]} 的课程名与查询信息不匹配: {item['kcm']} != {cl[2]}" f"课程 {cl[2]} 的课程名与查询信息不匹配: {item['kcm']} != {cl[2]}"
@ -355,7 +355,7 @@ class Lessons:
html = response.text html = response.text
redisKey = re.search(r'var redisKey = "(.+)";', html) redisKey = re.search(r'var redisKey = "(.+)";', html)
if not redisKey: if not redisKey:
print(html) # print(html)
logger.error(f"选课 {cl[2]} 时未找到 redisKey") logger.error(f"选课 {cl[2]} 时未找到 redisKey")
return False return False
redisKey = redisKey.group(1) redisKey = redisKey.group(1)
@ -381,7 +381,7 @@ class Lessons:
else: else:
logger.info(f"选课成功: {text}") logger.info(f"选课成功: {text}")
else: else:
print(f"{cnt}次查询中...") logger.info(f"{cnt}次查询中...")
cnt += 1 cnt += 1
sleep(1) sleep(1)