{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from requests import get,post\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from requests import get,post\n", "import time\n", "ip = \"http://band.hxzhxy.cn\"\n", "# ip = \"http://192.168.0.244:8100\"\n", "\n", "param = {\n", " \"username\": \"tangchao\",\n", " \"password\": \"123456a\",\n", " \"client_id\": \"client\",\n", " \"grant_type\": \"password\",\n", " \"client_secret\": \"123456\",\n", "}\n", "data = get(url=f\"http://band.hxzhxy.cn/oauth/token?username=zhongwei&password=123456a&client_id=client&grant_type=password&client_secret=123456\").json()\n", "token = data[\"access_token\"]\n", "header = {\n", " \"content-type\": \"application/json\",\n", " \"authorization\": f\"Bearer {token}\",\n", "}" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'success': True, 'msg': '操作成功', 'code': 0, 'data': '接收成功'}" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# ip = \"http://band.hxzhxy.cn\"\n", "ip = \"http://192.168.0.205:8090\"\n", "post(f\"{ip}/httpLock/log\",json={'lockId': '8686987', 'notifyType': '1', 'records': '[{\"lockId\":8686987,\"electricQuantity\":100,\"serverDate\":1758100706693,\"recordTypeFromLock\":17,\"recordType\":7,\"success\":1,\"lockMac\":\"FD:15:3A:7E:D1:E2\",\"keyboardPwd\":\"3157220353\",\"lockDate\":1758100692000,\"username\":\"夏天乐带0\"}]', 'admin': 'xtlft@qq.com', 'lockMac': 'FD:15:3A:7E:D1:E2'}).json()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import datetime\n", "s = int(datetime.datetime(2025,9,15).timestamp()*1000)\n", "e = int(datetime.datetime(2025,9,19).timestamp()*1000)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "data = post(f\"{ip}/lock/log/exportExcelStuCount\",params={\"teamId\":110,\"startTime\":s,\"endTime\":e},headers=header)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "with open (\"1.xlsx\",\"wb\") as f:\n", " f.write(data.content)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get(f\"{ip}/oauth/token\",params=param)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "404 Not Found\n", "\n", "

404 Not Found

\n", "
nginx/1.4.0
\n", "\n", "\n", "\n", "\n", "404 Not Found\n", "\n", "

404 Not Found

\n", "
nginx/1.4.0
\n", "\n", "\n", "\n", "{\"success\":false,\"msg\":\"系统错误\",\"code\":10000,\"data\":null}\n" ] } ], "source": [ "for i in range(24,27):\n", " print(post(f\"{ip}/classAttendStu/createThisWeek\",headers=header,params={\"planId\":i},timeout=600).text)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\"success\":false,\"msg\":\"系统错误\",\"code\":10000,\"data\":null}\n" ] } ], "source": [ "print(post(f\"{ip}/classAttendStu/createThisWeek\",headers=header,params={\"planId\":31},timeout=600).text)" ] } ], "metadata": { "kernelspec": { "display_name": "base", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.4" } }, "nbformat": 4, "nbformat_minor": 2 }