Beispiel #1
0
def login():
    stu_id = request.get_json()['stuId']
    password = request.get_json()['password']
    try:
        zf_session, name, board_msg = s_login(stu_id, password, url)
    except Exception as e:
        print(e)
        raise APIException("error", str(e), 401)
    return jsonify({'name': name, 'board_msg': board_msg})
Beispiel #2
0
def teaching_evaluate():
    stu_id = request.get_json()['stuId']
    password = request.get_json()['password']
    try:
        zf_session, name, board_msg = s_login(stu_id, password, url)
    except Exception as e:
        print(e)
        raise APIException("error", str(e), 403)
    from ZfQueryMod.teaching_evaluate import evaluate
    evaluate(stu_id, zf_session, url)
    return "ossas"
Beispiel #3
0
def get_course_table():
    stu_id = request.get_json()['stuId']
    password = request.get_json()['password']
    try:
        zf_session, name, board_msg = s_login(stu_id, password, url)
    except Exception as e:
        print(e)
        raise APIException("error", str(e), 403)
    from ZfQueryMod.query import course_table
    table = course_table(stu_id, zf_session, url)
    return jsonify(table)
Beispiel #4
0
def get_exams():
    stu_id = request.get_json()['stuId']
    password = request.get_json()['password']
    try:
        zf_session, name, board_msg = s_login(stu_id, password, url)
    except Exception as e:
        print(e)
        raise APIException("error", str(e), 403)
    from ZfQueryMod.query import query_exam
    table = query_exam(stu_id, zf_session, url)
    data = {'msg': table[0], 'exams': table[1]}
    return jsonify(data)
Beispiel #5
0
def history_scores():
    stu_id = request.get_json()['stuId']
    password = request.get_json()['password']
    try:
        zf_session, name, board_msg = s_login(stu_id, password, url)
    except Exception as e:
        print(e)
        raise APIException("error", str(e), 401)
    from ZfQueryMod.query import query_score
    from ZfQueryMod.gpa import average
    scores_list = query_score(stu_id, zf_session, url)
    if not scores_list:
        raise APIException("oops", "未进行教学评价", 403)
    data = {"scores": scores_list, "avg": average(scores_list)}
    return jsonify(data)