add
This commit is contained in:
@@ -9,7 +9,7 @@ def get_grade(student_client, output_type="none"):
|
|||||||
# 初始化grade为空列表
|
# 初始化grade为空列表
|
||||||
grade = []
|
grade = []
|
||||||
|
|
||||||
# 使用while循环最多重试5次获取个人信息
|
# 使用while循环最多重试5次获取成绩信息
|
||||||
while attempts > 0:
|
while attempts > 0:
|
||||||
|
|
||||||
# 调用student_client的get_grade方法获取成绩信息
|
# 调用student_client的get_grade方法获取成绩信息
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ def get_selected_courses(student_client):
|
|||||||
# 初始化selected_courses为空列表
|
# 初始化selected_courses为空列表
|
||||||
selected_courses = []
|
selected_courses = []
|
||||||
|
|
||||||
# 使用while循环最多重试5次获取个人信息
|
# 使用while循环最多重试5次获取已选课程信息
|
||||||
while attempts > 0:
|
while attempts > 0:
|
||||||
# 调用student_client的get_selected_courses方法获取已选课程信息
|
# 调用student_client的get_selected_courses方法获取已选课程信息
|
||||||
selected_courses_data = student_client.get_selected_courses().get("data", {})
|
selected_courses_data = student_client.get_selected_courses().get("data", {})
|
||||||
|
|||||||
@@ -59,9 +59,7 @@ def get_user_info(student_client, output_type="none"):
|
|||||||
else:
|
else:
|
||||||
# 如果未获取到成绩信息,返回仅包含个人信息的字符串
|
# 如果未获取到成绩信息,返回仅包含个人信息的字符串
|
||||||
return f"{info}"
|
return f"{info}"
|
||||||
else:
|
|
||||||
# 如果重试5次仍未获取到个人信息,返回错误提示
|
|
||||||
return "个人信息:\n获取个人信息失败"
|
|
||||||
except Exception:
|
except Exception:
|
||||||
# 捕获并打印所有异常的详细信息
|
# 捕获并打印所有异常的详细信息
|
||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
|
|||||||
Reference in New Issue
Block a user