美文网首页
正方系统课表、成绩查询 爬虫模块

正方系统课表、成绩查询 爬虫模块

作者: dairoot | 来源:发表于2018-10-05 20:02 被阅读0次

    安装模块 正方系统 api

    githubhttps://github.com/dairoot/school-api

    pip install School-Api

    使用示例

    from school_api import SchoolClient
    # 实例化一个用户
    school=SchoolClient(url='http://210.38.137.126:8016') 
    student=school.user_login('xxxx','xxxx',timeout=10)
    

    获取【个人课表】信息

    schedule_data=student.get_schedule()
    print(schedule_data)
    

    获取【班级课表】信息

    schedule_data=student.get_schedule(schedule_type=1)
    print(schedule_data)
    
    • 课表返回数据格式
    "schedule":[
    [[{"place": "8-503", "name": "形势与政策", "time": "8:30 ~ 10:05", "color": "blue", "section": 2, "weeks_text": "8", "weeks_arr": [8], "teacher": "潘晶晶"}], [{"place": "8-501", "name": "思政课实践教学", "time": "10:25 ~ 12:00", "color": "purple", "section": 2, "weeks_text": "7,13", "weeks_arr": [7, 13], "teacher": "周红禄"}, {"place": "8-505", "name": "毛泽东思想和中国特色社会主义理论体系概论", "time": "10:25 ~ 12:00", "color": "purple", "section": 2, "weeks_text": "1-6,8-12,14-18", "weeks_arr": [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18], "teacher": "周红禄"}], [{"place": "4-402", "name": "大学生职业发展与就业指导", "time": "14:40 ~ 16:15", "color": "red", "section": 2, "weeks_text": "1-4", "weeks_arr": [1, 2, 3, 4], "teacher": "朱玲梅"}], [], []],
    [[], [{"place": "9-202", "name": "Android开发技术", "time": "10:25 ~ 12:00", "color": "green", "section": 2, "weeks_text": "1-19", "weeks_arr": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], "teacher": "段汝林"}], [], [], []],
    [[{"place": "8-506", "name": "UI设计及应用", "time": "8:30 ~ 12:00", "color": "purple", "section": 4, "weeks_text": "1-19", "weeks_arr": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], "teacher": "陈萍"}], [], [{"place": "8-306", "name": "数据库应用技术", "time": "14:40 ~ 17:15", "color": "yellow", "section": 3, "weeks_text": "1-19", "weeks_arr": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], "teacher": "张晓健"}], [], []],
    [[], [{"place": "9-202", "name": "Java Web开发技术", "time": "10:25 ~ 12:00", "color": "blue", "section": 2, "weeks_text": "1-19", "weeks_arr": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], "teacher": "段汝林"}], [{"place": "9-202", "name": "Android开发技术", "time": "14:40 ~ 16:15", "color": "purple", "section": 2, "weeks_text": "1-19", "weeks_arr": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], "teacher": "段汝林"}], [{"place": "8-503", "name": "形势与政策", "time": "16:30 ~ 18:05", "color": "red", "section": 2, "weeks_text": "10", "weeks_arr": [10], "teacher": "卓泽楼"}], []],
    [[{"place": "9-202", "name": "Java Web开发技术", "time": "8:30 ~ 10:05", "color": "red", "section": 2, "weeks_text": "1-19", "weeks_arr": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19], "teacher": "段汝林"}], [], [], [], []],
    [[], [], [], [], []],
    [[], [], [], [], []]
    ]
    }
    

    获取【成绩】信息

    score_data=student.get_score(use_api=0)  
    print(score_data)
    
    • 成绩返回数据格式
    {
    "2016-2017": {
        "1": [{"credit": 3.0, "score": 68.0, "lesson_name": "管理学原理", "point": 1.8}, {"credit": 3.5, "score": 84.0, "lesson_name": "离散数学", "point": 3.4}, {"credit": 4.0, "score": 64.0, "lesson_name": "数据结构", "point": 1.4}, {"credit": 4.0, "score": 68.0, "lesson_name": "数据库原理及应用", "point": 1.8}, {"credit": 3.5, "score": 78.0, "lesson_name": "大学英语3", "point": 2.8}, {"credit": 1.0, "score": 79.0, "lesson_name": "瑜伽", "point": 2.9}, {"credit": 2.5, "score": 68.0, "lesson_name": "马克思主义基本原理", "point": 1.8}, {"credit": 0.5, "score": 80.0, "lesson_name": "形势与政策教育2", "point": 3.0}, {"credit": 0.5, "score": 84.0, "lesson_name": "创新创业教育1", "point": 3.4}, {"credit": 1.0, "score": "中等", "lesson_name": "数据结构课程设计", "point": 2.5}, {"credit": 1.0, "score": "优秀", "lesson_name": "数据库原理及应用课程设计", "point": 4.5}],
        "2": [{"credit": 3.0, "score": 92.0, "lesson_name": "会计学原理", "point": 4.2}, {"credit": 3.5, "score": 78.0, "lesson_name": "Java程序设计", "point": 2.8}, {"credit": 3.0, "score": 69.0, "lesson_name": "运筹学Ⅱ", "point": 1.9}, {"credit": 3.5, "score": 86.0, "lesson_name": "概率论与数理统计", "point": 3.6}, {"credit": 3.5, "score": 78.0, "lesson_name": "大学英语4", "point": 2.8}, {"credit": 1.0, "score": 86.0, "lesson_name": "武术", "point": 3.6}, {"credit": 4.5, "score": 88.0, "lesson_name": "毛泽东思想和中国特色社会主义理论体系概论", "point": 3.8}, {"credit": 1.0, "score": 85.0, "lesson_name": "Java程序设计课程设计", "point": 3.5}, {"credit": 1.0, "score": "良好", "lesson_name": "生产认识实习", "point": 3.5}]
    },
    "2017-2018": {
        "1": [{"credit": 3.0, "score": 84.0, "lesson_name": "经济学原理", "point": 3.4}, {"credit": 3.5, "score": 81.0, "lesson_name": "操作系统", "point": 3.1}, {"credit": 3.5, "score": 96.0, "lesson_name": "信息系统分析与设计", "point": 4.6}, {"credit": 4.0, "score": 76.0, "lesson_name": "计算机网络", "point": 2.6}, {"credit": 2.0, "score": 81.0, "lesson_name": "物联网概论", "point": 3.1}, {"credit": 0.5, "score": 88.0, "lesson_name": "形势与政策教育3", "point": 3.8}, {"credit": 1.0, "score": 95.0, "lesson_name": "企业经营模拟实践", "point": 4.5}, {"credit": 1.0, "score": "良好", "lesson_name": "计算机网络应用设计", "point": 3.5}], 
        "2": [{"credit": 3.0, "score": 84.0, "lesson_name": "Web开发技术", "point": 3.4}, {"credit": 3.0, "score": 88.0, "lesson_name": "管理信息系统", "point": 3.8}, {"credit": 2.0, "score": 92.0, "lesson_name": "信息资源组织与管理", "point": 4.2}, {"credit": 0.5, "score": 85.0, "lesson_name": "形势与政策教育4", "point": 3.5}, {"credit": 0.5, "score": 90.0, "lesson_name": "创新创业教育2", "point": 4.0}, {"credit": 1.0, "score": "良好", "lesson_name": "Web开发技术课程实习", "point": 3.5}, {"credit": 2.0, "score": 77.0, "lesson_name": "思政课实践环节", "point": 2.7}]
    }, 
    "2015-2016": {
        "1": [{"credit": 3.5, "score": 65.0, "lesson_name": "程序设计基础", "point": 1.5}, {"credit": 1.0, "score": "良好", "lesson_name": "计算机基础实践(实验)", "point": 3.5}, {"credit": 1.0, "score": "良好", "lesson_name": "信息管理与信息系统专业导论", "point": 3.5}, {"credit": 4.5, "score": 66.0, "lesson_name": "高等数学Ⅰx1", "point": 1.6}, {"credit": 3.5, "score": 76.0, "lesson_name": "大学英语1", "point": 2.6}, {"credit": 1.0, "score": 83.0, "lesson_name": "普拉提", "point": 3.3}, {"credit": 3.0, "score": 75.0, "lesson_name": "思想道德修养与法律基础", "point": 2.5}, {"credit": 0.5, "score": 89.0, "lesson_name": "形势与政策教育1", "point": 3.9}, {"credit": 0.5, "score": 90.0, "lesson_name": "青年学生健康教育", "point": 4.0}, {"credit": 1.0, "score": "良好", "lesson_name": "程序设计基础课程设计", "point": 3.5}], 
        "2": [{"credit": 2.5, "score": 60.0, "lesson_name": "面向对象程序设计", "point": 1.0}, {"credit": 5.0, "score": 60.0, "lesson_name": "电路与电子技术基础", "point": 1.0}, {"credit": 5.0, "score": 74.0, "lesson_name": "高等数学Ⅰx2", "point": 2.4}, {"credit": 1.5, "score": 63.0, "lesson_name": "线性代数", "point": 1.3}, {"credit": 3.5, "score": 80.0, "lesson_name": "大学英语2", "point": 3.0}, {"credit": 1.0, "score": 80.0, "lesson_name": "健美操", "point": 3.0}, {"credit": 2.0, "score": 91.0, "lesson_name": "中国近现代史纲要", "point": 4.1}, {"credit": 2.0, "score": 89.0, "lesson_name": "军事理论", "point": 3.9}, {"credit": 0.5, "score": 83.0, "lesson_name": "大学生心理健康教育", "point": 3.3}, {"credit": 1.0, "score": "良好", "lesson_name": "面向对象程序设计实践", "point": 3.5}]
    }
    }
    

    获取【用户】信息

    info_data=student.get_info()
    print(info_data)
    
    • 用户信息返回数据格式
    {   
        "real_name": "姓名",
        "birth_date": "出生日期",
        "id_card": "身份证",
        "enrol_time": "入学日期",
        "grade": "年级",
        "hometown": "省份",
        "sex": "性别",
        "faculty": "院系部",
        "specialty": "专业",
        "class_name": "班级"
    }
    

    【阅读文档】 使用示例参见 examples

    相关文章

      网友评论

          本文标题:正方系统课表、成绩查询 爬虫模块

          本文链接:https://www.haomeiwen.com/subject/ymoqaftx.html