平生多感激,忠义非外奖。——李白《酬裴侍御对雨感时见赠》 楠少博客 阅读文章 常州大学/企业微信/电费查询脚本 楠少 2021-10-20 6666666 8888888 Python 常州大学 开源 摘要常州大学/相关接口、协议、脚本开源(合集) > 常州大学/企业微信/电费查询脚本 ## 企业微信 电费查询脚本 [博客 https://blog.nanshaobit.top/106](https://blog.nanshaobit.top/106) ### 仓库 + [GitHub](https://github.com/nanshaobit/cczu_script/tree/master/wechat_query_elec_room_info) + [Gitee](https://gitee.com/nanshaobit/cczu_script/tree/master/wechat_query_elec_room_info) ### 其他所有接口汇总: https://blog.nanshaobit.top/104 > account 为用户id, 可抓包获得(随机也可,存在就行)。 > aid 应用id 两个校区不同 ### 获取楼栋接口 + url: `http://wxxy.cczu.edu.cn/wechat/callinterface/queryElecBuilding.html` + method: `POST` + data: 具体见 main.py:get_area() ```json { "aid": area["aid"], // 应用ID "account": "100000", // 用户id "area": area["value"] // 区域 } ``` + 数据位置: 返回数据 json["buildingtab"] ### 查询电费接口 + url: `http://wxxy.cczu.edu.cn/wechat/callinterface/queryElecRoomInfo.html` + method: `POST` + data: 具体见 main.py:get_data() ```json // 除有注释外,其他内容正常情况不需要修改。 { "aid": area["aid"], // 应用ID "account": "100000", // 用户id "area": area["value"] // 区域 "building": str(building), // 楼栋信息 "floor": '{"floorid":"","floor":""}', // 置空 "room": f'{{"room":"","roomid":"{rid}"}}'} // 房间id } ``` + 数据位置: 返回数据 json["errmsg"] (可能出错, 提示也在该位置,需要判断) ### 脚本 > 依赖库: `requests` [脚本]main.py 使用控制台输入方式交互, 可修改为其他方式交互 如:web、机器人 ```python3 # @DateTime : 2021-10-20 12:57 # @Author : Nanshao # @Mail : Nanshao@n-s.fun # @Description : import requests """ 所有输入 均未做容错处理。 """ s = requests.Session() def get_input_from_ls(ls, k): for i, v in enumerate(ls): print(f"{i}: -> {v[k]}") return ls[int(input("输入序号即可:"))] def get_area(): ls_area = [{ "title": "西太湖校区(1-9号楼)", "value": '{"area":"西太湖校区","areaname":"西太湖校区"}', "aid": "0030000000002501" }, { "title": "武进校区及西太湖校区(10-11号楼)", "value": '{"area":"武进校区","areaname":"武进校区"}', "aid": "0030000000002502" }] return get_input_from_ls(ls_area, "title") def get_building(area): with s.post("http://wxxy.cczu.edu.cn/wechat/callinterface/queryElecBuilding.html", data={ "aid": area["aid"], "account": "100000", "area": area["value"], }) as resp: ls_building = resp.json().get("buildingtab") return get_input_from_ls(ls_building, "building") def get_data(area, building, rid): print("query") print("*" * 50) url = "http://wxxy.cczu.edu.cn/wechat/callinterface/queryElecRoomInfo.html" with s.post(url, data={ "aid": area["aid"], "account": "100000", "area": area["value"], "building": str(building), "floor": '{"floorid":"","floor":""}', "room": f'{{"room":"","roomid":"{rid}"}}'}) as resp: print(resp.json()) print(resp.json()["errmsg"]) def query(): area = get_area() building = get_building(area) rid = input("输入房间号:") get_data(area, building, rid) if __name__ == '__main__': query() ``` 上一篇:常州大学/教务系统/教室相关 下一篇:常州大学/相关接口、协议、脚本开源(合集) 文章评论 [ 聊聊技术 聊聊自己 ] 在巴甫洛夫条件反射 试验中:给定一条狗,每次摇铃后喂食,足够次数后,狗则听到铃声将会习惯性的分泌唾液,由此引发对铃声的依恋。延伸到实际,给定一个喜欢的妹子,每次见面赠与巴甫洛夫式 的礼品或者零食,由此引发妹子的依恋。引入薛定谔的猫 理论,在未表白前,妹子与自己一直处于一种“概率云”的状态,一旦表白则“概率云”将消失成为实际。在 巴甫洛夫式 后且未表白前,自己与妹子的关系为“既是恋人又不是恋人”的矛盾体。返回巴甫洛夫式 试验中,在妹纸形成足够的依恋过后,则可以打破薛定谔 “概率云”的状态。这个谜一样的自己,这一刻 薛定谔 附体,带着量子论般深沉的哀愁,让她从此不能自拔! 自此创作 巴甫洛夫薛定谔把妹法,深藏功与名。