feat: 添加多个功能模块和工具脚本
- 新增websocket客户端和服务端实现 - 添加图片压缩工具和快速压缩脚本 - 实现学生信息处理相关API - 添加MQTT客户端和消息处理功能 - 更新.gitignore忽略更多文件类型 - 添加数据库操作工具和示例 - 实现多个测试脚本和工具类
This commit is contained in:
+40
-70
@@ -27,24 +27,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 2,
|
||||
"id": "03513226",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "",
|
||||
"evalue": "",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m在当前单元格或上一个单元格中执行代码时 Kernel 崩溃。\n",
|
||||
"\u001b[1;31m请查看单元格中的代码,以确定故障的可能原因。\n",
|
||||
"\u001b[1;31m单击<a href='https://aka.ms/vscodeJupyterKernelCrash'>此处</a>了解详细信息。\n",
|
||||
"\u001b[1;31m有关更多详细信息,请查看 Jupyter <a href='command:jupyter.viewOutput'>log</a>。"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data = get(f\"https://band.hxzhxy.cn/door/lock/listLockPage?teamId=119&pageSize=60&pageNumber=0&value=&areaId=&tierId=®ionId=&bindType=&lockName=&type=2&mainTypeId=&sizeType=&lockType=&access_token={token}\").json()"
|
||||
"data = get(f\"https://band.hxzhxy.cn/door/lock/listLockPage?teamId=119&pageSize=100&pageNumber=0&value=&areaId=&tierId=®ionId=&bindType=&lockName=&type=2&mainTypeId=&sizeType=&lockType=&access_token={token}\").json()"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -64,12 +52,12 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"serialNos=['1619991908']"
|
||||
"serialNos=['3478767249']"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 6,
|
||||
"id": "673efe31",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -77,58 +65,32 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n"
|
||||
"{\"success\":false,\"msg\":\"Index: 0, Size: 0\",\"code\":10000,\"data\":null}\n",
|
||||
"{\"success\":false,\"msg\":\"Index: 0, Size: 0\",\"code\":10000,\"data\":null}\n",
|
||||
"{\"success\":false,\"msg\":\"Index: 0, Size: 0\",\"code\":10000,\"data\":null}\n",
|
||||
"{\"success\":false,\"msg\":\"Index: 0, Size: 0\",\"code\":10000,\"data\":null}\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ename": "KeyboardInterrupt",
|
||||
"evalue": "",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[6], line 3\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m item \u001b[38;5;129;01min\u001b[39;00m data[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdata\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcontent\u001b[39m\u001b[38;5;124m\"\u001b[39m]:\n\u001b[0;32m 2\u001b[0m addAdminBand \u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m,\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(serialNos)\n\u001b[1;32m----> 3\u001b[0m a \u001b[38;5;241m=\u001b[39mpost(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhttps://band.hxzhxy.cn/door/accredit/sendNews\u001b[39m\u001b[38;5;124m\"\u001b[39m,json\u001b[38;5;241m=\u001b[39m{\n\u001b[0;32m 4\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstartTime\u001b[39m\u001b[38;5;124m\"\u001b[39m:\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m25082114\u001b[39m\u001b[38;5;124m\"\u001b[39m,\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mendTime\u001b[39m\u001b[38;5;124m\"\u001b[39m:\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m35051814\u001b[39m\u001b[38;5;124m\"\u001b[39m,\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124madminType\u001b[39m\u001b[38;5;124m\"\u001b[39m:\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m55\u001b[39m\u001b[38;5;124m\"\u001b[39m,\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtype\u001b[39m\u001b[38;5;124m\"\u001b[39m:\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m01\u001b[39m\u001b[38;5;124m\"\u001b[39m,\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtime\u001b[39m\u001b[38;5;124m\"\u001b[39m:[\u001b[38;5;241m1761874564434\u001b[39m,\u001b[38;5;241m4097093791000\u001b[39m],\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124maccountIp\u001b[39m\u001b[38;5;124m\"\u001b[39m:\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m183.220.92.213\u001b[39m\u001b[38;5;124m\"\u001b[39m,\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124maccountName\u001b[39m\u001b[38;5;124m\"\u001b[39m:\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m183.220.92.213\u001b[39m\u001b[38;5;124m\"\u001b[39m,\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlockNo\u001b[39m\u001b[38;5;124m\"\u001b[39m:item[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlockNo\u001b[39m\u001b[38;5;124m\"\u001b[39m],\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mserialNo\u001b[39m\u001b[38;5;124m\"\u001b[39m:item[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mserialNo\u001b[39m\u001b[38;5;124m\"\u001b[39m],\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124maddAdminBand\u001b[39m\u001b[38;5;124m\"\u001b[39m:\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m,\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124maddUserBand\u001b[39m\u001b[38;5;124m\"\u001b[39m:\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m,\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mremoveBand\u001b[39m\u001b[38;5;124m\"\u001b[39m:addAdminBand,\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdoorAccreditIds\u001b[39m\u001b[38;5;124m\"\u001b[39m:\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 5\u001b[0m },headers\u001b[38;5;241m=\u001b[39mheader)\u001b[38;5;241m.\u001b[39mtext\n\u001b[0;32m 6\u001b[0m \u001b[38;5;28mprint\u001b[39m(a)\n\u001b[0;32m 7\u001b[0m time\u001b[38;5;241m.\u001b[39msleep(\u001b[38;5;241m1\u001b[39m)\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\requests\\api.py:115\u001b[0m, in \u001b[0;36mpost\u001b[1;34m(url, data, json, **kwargs)\u001b[0m\n\u001b[0;32m 103\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mpost\u001b[39m(url, data\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, json\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[0;32m 104\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124mr\u001b[39m\u001b[38;5;124;03m\"\"\"Sends a POST request.\u001b[39;00m\n\u001b[0;32m 105\u001b[0m \n\u001b[0;32m 106\u001b[0m \u001b[38;5;124;03m :param url: URL for the new :class:`Request` object.\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 112\u001b[0m \u001b[38;5;124;03m :rtype: requests.Response\u001b[39;00m\n\u001b[0;32m 113\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 115\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m request(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpost\u001b[39m\u001b[38;5;124m\"\u001b[39m, url, data\u001b[38;5;241m=\u001b[39mdata, json\u001b[38;5;241m=\u001b[39mjson, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\requests\\api.py:59\u001b[0m, in \u001b[0;36mrequest\u001b[1;34m(method, url, **kwargs)\u001b[0m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;66;03m# By using the 'with' statement we are sure the session is closed, thus we\u001b[39;00m\n\u001b[0;32m 56\u001b[0m \u001b[38;5;66;03m# avoid leaving sockets open which can trigger a ResourceWarning in some\u001b[39;00m\n\u001b[0;32m 57\u001b[0m \u001b[38;5;66;03m# cases, and look like a memory leak in others.\u001b[39;00m\n\u001b[0;32m 58\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m sessions\u001b[38;5;241m.\u001b[39mSession() \u001b[38;5;28;01mas\u001b[39;00m session:\n\u001b[1;32m---> 59\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m session\u001b[38;5;241m.\u001b[39mrequest(method\u001b[38;5;241m=\u001b[39mmethod, url\u001b[38;5;241m=\u001b[39murl, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\requests\\sessions.py:589\u001b[0m, in \u001b[0;36mSession.request\u001b[1;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[0;32m 584\u001b[0m send_kwargs \u001b[38;5;241m=\u001b[39m {\n\u001b[0;32m 585\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtimeout\u001b[39m\u001b[38;5;124m\"\u001b[39m: timeout,\n\u001b[0;32m 586\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mallow_redirects\u001b[39m\u001b[38;5;124m\"\u001b[39m: allow_redirects,\n\u001b[0;32m 587\u001b[0m }\n\u001b[0;32m 588\u001b[0m send_kwargs\u001b[38;5;241m.\u001b[39mupdate(settings)\n\u001b[1;32m--> 589\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msend(prep, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39msend_kwargs)\n\u001b[0;32m 591\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m resp\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\requests\\sessions.py:703\u001b[0m, in \u001b[0;36mSession.send\u001b[1;34m(self, request, **kwargs)\u001b[0m\n\u001b[0;32m 700\u001b[0m start \u001b[38;5;241m=\u001b[39m preferred_clock()\n\u001b[0;32m 702\u001b[0m \u001b[38;5;66;03m# Send the request\u001b[39;00m\n\u001b[1;32m--> 703\u001b[0m r \u001b[38;5;241m=\u001b[39m adapter\u001b[38;5;241m.\u001b[39msend(request, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[0;32m 705\u001b[0m \u001b[38;5;66;03m# Total elapsed time of the request (approximately)\u001b[39;00m\n\u001b[0;32m 706\u001b[0m elapsed \u001b[38;5;241m=\u001b[39m preferred_clock() \u001b[38;5;241m-\u001b[39m start\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\requests\\adapters.py:589\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[1;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[0;32m 586\u001b[0m timeout \u001b[38;5;241m=\u001b[39m TimeoutSauce(connect\u001b[38;5;241m=\u001b[39mtimeout, read\u001b[38;5;241m=\u001b[39mtimeout)\n\u001b[0;32m 588\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 589\u001b[0m resp \u001b[38;5;241m=\u001b[39m conn\u001b[38;5;241m.\u001b[39murlopen(\n\u001b[0;32m 590\u001b[0m method\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mmethod,\n\u001b[0;32m 591\u001b[0m url\u001b[38;5;241m=\u001b[39murl,\n\u001b[0;32m 592\u001b[0m body\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mbody,\n\u001b[0;32m 593\u001b[0m headers\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mheaders,\n\u001b[0;32m 594\u001b[0m redirect\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 595\u001b[0m assert_same_host\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 596\u001b[0m preload_content\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 597\u001b[0m decode_content\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 598\u001b[0m retries\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmax_retries,\n\u001b[0;32m 599\u001b[0m timeout\u001b[38;5;241m=\u001b[39mtimeout,\n\u001b[0;32m 600\u001b[0m chunked\u001b[38;5;241m=\u001b[39mchunked,\n\u001b[0;32m 601\u001b[0m )\n\u001b[0;32m 603\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (ProtocolError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[0;32m 604\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(err, request\u001b[38;5;241m=\u001b[39mrequest)\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\urllib3\\connectionpool.py:787\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[1;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[0m\n\u001b[0;32m 784\u001b[0m response_conn \u001b[38;5;241m=\u001b[39m conn \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m release_conn \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m 786\u001b[0m \u001b[38;5;66;03m# Make the request on the HTTPConnection object\u001b[39;00m\n\u001b[1;32m--> 787\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_make_request(\n\u001b[0;32m 788\u001b[0m conn,\n\u001b[0;32m 789\u001b[0m method,\n\u001b[0;32m 790\u001b[0m url,\n\u001b[0;32m 791\u001b[0m timeout\u001b[38;5;241m=\u001b[39mtimeout_obj,\n\u001b[0;32m 792\u001b[0m body\u001b[38;5;241m=\u001b[39mbody,\n\u001b[0;32m 793\u001b[0m headers\u001b[38;5;241m=\u001b[39mheaders,\n\u001b[0;32m 794\u001b[0m chunked\u001b[38;5;241m=\u001b[39mchunked,\n\u001b[0;32m 795\u001b[0m retries\u001b[38;5;241m=\u001b[39mretries,\n\u001b[0;32m 796\u001b[0m response_conn\u001b[38;5;241m=\u001b[39mresponse_conn,\n\u001b[0;32m 797\u001b[0m preload_content\u001b[38;5;241m=\u001b[39mpreload_content,\n\u001b[0;32m 798\u001b[0m decode_content\u001b[38;5;241m=\u001b[39mdecode_content,\n\u001b[0;32m 799\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mresponse_kw,\n\u001b[0;32m 800\u001b[0m )\n\u001b[0;32m 802\u001b[0m \u001b[38;5;66;03m# Everything went great!\u001b[39;00m\n\u001b[0;32m 803\u001b[0m clean_exit \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\urllib3\\connectionpool.py:464\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[1;34m(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)\u001b[0m\n\u001b[0;32m 461\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 462\u001b[0m \u001b[38;5;66;03m# Trigger any extra validation we need to do.\u001b[39;00m\n\u001b[0;32m 463\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 464\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_validate_conn(conn)\n\u001b[0;32m 465\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (SocketTimeout, BaseSSLError) \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m 466\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_raise_timeout(err\u001b[38;5;241m=\u001b[39me, url\u001b[38;5;241m=\u001b[39murl, timeout_value\u001b[38;5;241m=\u001b[39mconn\u001b[38;5;241m.\u001b[39mtimeout)\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\urllib3\\connectionpool.py:1093\u001b[0m, in \u001b[0;36mHTTPSConnectionPool._validate_conn\u001b[1;34m(self, conn)\u001b[0m\n\u001b[0;32m 1091\u001b[0m \u001b[38;5;66;03m# Force connect early to allow us to validate the connection.\u001b[39;00m\n\u001b[0;32m 1092\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m conn\u001b[38;5;241m.\u001b[39mis_closed:\n\u001b[1;32m-> 1093\u001b[0m conn\u001b[38;5;241m.\u001b[39mconnect()\n\u001b[0;32m 1095\u001b[0m \u001b[38;5;66;03m# TODO revise this, see https://github.com/urllib3/urllib3/issues/2791\u001b[39;00m\n\u001b[0;32m 1096\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m conn\u001b[38;5;241m.\u001b[39mis_verified \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m conn\u001b[38;5;241m.\u001b[39mproxy_is_verified:\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\urllib3\\connection.py:753\u001b[0m, in \u001b[0;36mHTTPSConnection.connect\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 751\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 752\u001b[0m sock: socket\u001b[38;5;241m.\u001b[39msocket \u001b[38;5;241m|\u001b[39m ssl\u001b[38;5;241m.\u001b[39mSSLSocket\n\u001b[1;32m--> 753\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msock \u001b[38;5;241m=\u001b[39m sock \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_new_conn()\n\u001b[0;32m 754\u001b[0m server_hostname: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhost\n\u001b[0;32m 755\u001b[0m tls_in_tls \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\urllib3\\connection.py:198\u001b[0m, in \u001b[0;36mHTTPConnection._new_conn\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 193\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Establish a socket connection and set nodelay settings on it.\u001b[39;00m\n\u001b[0;32m 194\u001b[0m \n\u001b[0;32m 195\u001b[0m \u001b[38;5;124;03m:return: New socket connection.\u001b[39;00m\n\u001b[0;32m 196\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 197\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 198\u001b[0m sock \u001b[38;5;241m=\u001b[39m connection\u001b[38;5;241m.\u001b[39mcreate_connection(\n\u001b[0;32m 199\u001b[0m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_dns_host, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mport),\n\u001b[0;32m 200\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtimeout,\n\u001b[0;32m 201\u001b[0m source_address\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msource_address,\n\u001b[0;32m 202\u001b[0m socket_options\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msocket_options,\n\u001b[0;32m 203\u001b[0m )\n\u001b[0;32m 204\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m socket\u001b[38;5;241m.\u001b[39mgaierror \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m 205\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m NameResolutionError(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhost, \u001b[38;5;28mself\u001b[39m, e) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01me\u001b[39;00m\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\urllib3\\util\\connection.py:73\u001b[0m, in \u001b[0;36mcreate_connection\u001b[1;34m(address, timeout, source_address, socket_options)\u001b[0m\n\u001b[0;32m 71\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m source_address:\n\u001b[0;32m 72\u001b[0m sock\u001b[38;5;241m.\u001b[39mbind(source_address)\n\u001b[1;32m---> 73\u001b[0m sock\u001b[38;5;241m.\u001b[39mconnect(sa)\n\u001b[0;32m 74\u001b[0m \u001b[38;5;66;03m# Break explicitly a reference cycle\u001b[39;00m\n\u001b[0;32m 75\u001b[0m err \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n",
|
||||
"\u001b[1;31mKeyboardInterrupt\u001b[0m: "
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -136,13 +98,21 @@
|
||||
"for item in data[\"data\"][\"content\"]:\n",
|
||||
" addAdminBand =\",\".join(serialNos)\n",
|
||||
" a =post(\"https://band.hxzhxy.cn/door/accredit/sendNews\",json={\n",
|
||||
" \"startTime\":\"25082114\",\"endTime\":\"35051814\",\"adminType\":\"55\",\"type\":\"01\",\"time\":[1755756984314,2071380076000],\"accountIp\":\"183.220.92.213\",\"accountName\":\"183.220.92.213\",\"lockNo\":item[\"lockNo\"],\"serialNo\":item[\"serialNo\"],\"addAdminBand\":\"\",\"addUserBand\":addAdminBand,\"removeBand\":\"\",\"doorAccreditIds\":\"\"\n",
|
||||
" \"startTime\":\"25082114\",\"endTime\":\"35051814\",\"adminType\":\"55\",\"type\":\"01\",\"time\":[1761874564434,4097093791000],\"accountIp\":\"183.220.92.213\",\"accountName\":\"183.220.92.213\",\"lockNo\":item[\"lockNo\"],\"serialNo\":item[\"serialNo\"],\"addAdminBand\":\"\",\"addUserBand\":\"\",\"removeBand\":addAdminBand,\"doorAccreditIds\":\"\"\n",
|
||||
" },headers=header).text\n",
|
||||
" print(a)\n",
|
||||
" time.sleep(1)\n",
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d4456938",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#下发密码"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "53568812",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from requests import get,post\n",
|
||||
"import time\n",
|
||||
"ip = \"http://band.hxzhxy.cn\"\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\",params=param).json()\n",
|
||||
"token = data[\"access_token\"]\n",
|
||||
"header = {\n",
|
||||
" \"content-type\": \"application/json\",\n",
|
||||
" \"authorization\": f\"Bearer {token}\",\n",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "dd37d282",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data = get(\"https://www.hxzhxy.cn/hxyd-api/uc/student/pageInfo?teamId=119&gradeId=127&classId=483&name=&type=0&pageSize=50&pageNumber=0&orderDirection=asc&access_token=0cfa97d4-2b01-4be4-a7f7-13179d149e56\").json()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "eaa3dadd",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"serialNo = []\n",
|
||||
"for item in data[\"data\"][\"content\"]:\n",
|
||||
" serialNo.append(item[\"seralNo\"])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"id": "aedb175d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"serialNos = \",\".join(serialNo)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"id": "fff85f0a",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"result =post(\"https://band.hxzhxy.cn/door/accredit/sendNews\",json={\"startTime\":\"25083115\",\"endTime\":\"28052815\",\"adminType\":\"55\",\"type\":\"01\",\"time\":[1756625633772,1843112033772],\"accountIp\":\"183.220.92.52\",\"accountName\":\"183.220.92.52\",\"lockNo\":\"181681774465\",\"serialNo\":serialNos,\"addAdminBand\":\"\",\"addUserBand\":\"\",\"removeBand\":\"\",\"doorAccreditIds\":\"\"},headers=header).text\n",
|
||||
"print(result)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"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": 5
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"id": "d9c14718",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from requests import get,post\n",
|
||||
"import time\n",
|
||||
"ip = \"http://band.hxzhxy.cn\"\n",
|
||||
"# ip = \"http://192.168.0.209:8100\"\n",
|
||||
"param = {\n",
|
||||
" \"username\": \"tw_xiatianle\",\n",
|
||||
" \"password\": \"xia123456\",\n",
|
||||
" \"client_id\": \"client\",\n",
|
||||
" \"grant_type\": \"password\",\n",
|
||||
" \"client_secret\": \"123456\",\n",
|
||||
"}\n",
|
||||
"data = get(url=f\"{ip}/oauth/token\",params=param).json()\n",
|
||||
"token = data[\"access_token\"]\n",
|
||||
"header = {\n",
|
||||
" \"content-type\": \"application/json\",\n",
|
||||
" \"authorization\": f\"Bearer {token}\",\n",
|
||||
"}\n",
|
||||
"teamId=\"119\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"id": "1673af54",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data = get(f\"{ip}/workforce/classTeamMachine/list\",headers=header,params={\n",
|
||||
" \"page\": \"0\",\n",
|
||||
" \"size\": \"100\",\n",
|
||||
" \"teamId\": teamId\n",
|
||||
"}).json()[\"data\"][\"content\"]\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"id": "4cf83c82",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"tem = []\n",
|
||||
"for item in data:\n",
|
||||
" if item[\"classroom\"] != \"鸿兴测试分组\":\n",
|
||||
" tem.append(item)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"id": "1790800e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data = tem"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"id": "34f18ca5",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from paho.mqtt import client as mqtt\n",
|
||||
"import json"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"id": "7cf83679",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"0"
|
||||
]
|
||||
},
|
||||
"execution_count": 23,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"broker = 'band.hxzhxy.cn'\n",
|
||||
"# broker = '192.168.0.111'\n",
|
||||
"port = 1883\n",
|
||||
"topic = \"/python/mqtt\"\n",
|
||||
"client_id = f'python-mqtt-demo'\n",
|
||||
"# MQTT客户端的回调函数\n",
|
||||
"def on_connect(client, userdata, flags, rc):\n",
|
||||
" print(\"Connected with result code \"+str(rc))\n",
|
||||
" # 连接成功后订阅主题\n",
|
||||
" # client.subscribe(\"#\")\n",
|
||||
"\n",
|
||||
"def on_message(client, userdata, msg):\n",
|
||||
" print(msg.topic+\" \"+str(msg.payload))\n",
|
||||
"\n",
|
||||
"# 创建MQTT客户端实例\n",
|
||||
"client = mqtt.Client(client_id=client_id)\n",
|
||||
"\n",
|
||||
"# 绑定回调函数\n",
|
||||
"client.on_connect = on_connect\n",
|
||||
"client.on_message = on_message\n",
|
||||
"\n",
|
||||
"# 连接到MQTT代理\n",
|
||||
"client.connect(broker, port, 60)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"id": "e706bbb0",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x1b6a5f5e0c0>"
|
||||
]
|
||||
},
|
||||
"execution_count": 24,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"client.publish(topic, \"hello world\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "72c9ff77",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for item in data[0:1]:\n",
|
||||
" print(item)\n",
|
||||
" mac=item[\"mac\"]\n",
|
||||
" topic=f\"cmd/publicizeBanpai/08E60E75E09E/control\"\n",
|
||||
" message={\n",
|
||||
" \"type\":\"info\"\n",
|
||||
" }\n",
|
||||
" client.publish(topic, json.dumps(message,ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 31,
|
||||
"id": "82403f63",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x1b6a5c2bec0>"
|
||||
]
|
||||
},
|
||||
"execution_count": 31,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"topic=f\"cmd/publicizeBanpai/08E60E75E09E/control\"\n",
|
||||
"message={\"type\":\"info\"}\n",
|
||||
"client.publish(topic, json.dumps(message,ensure_ascii=True))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "8ff4367a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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": "undefined.undefined.undefined"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import paho.mqtt.client as mqtt
|
||||
import json
|
||||
import time
|
||||
import datetime
|
||||
|
||||
# MQTT 配置
|
||||
# BROKER = "100.68.18.111" # 与发送端相同
|
||||
BROKER = "band.hxzhxy.cn" # 与发
|
||||
PORT = 1883
|
||||
TOPICs = ["cmd/publicizeBanpai/#","upload/publicizeBanpai/#","common/publicizeBanpai/#"] # 与发送端相同
|
||||
CLIENT_ID = "python-mqtt-receiver"
|
||||
|
||||
|
||||
# 收到消息时的回调
|
||||
def on_message(client, userdata, msg):
|
||||
try:
|
||||
payload = msg.payload.decode()
|
||||
mac = msg.topic.split("/")[2]
|
||||
print("\n" + "=" * 50)
|
||||
print(f"收到新消息 [QoS: {msg.qos}]")
|
||||
print(f"客户端 ID: {mac}")
|
||||
print(f"主题: {msg.topic}")
|
||||
if "message" in msg.topic:
|
||||
|
||||
data = json.loads(json.loads(payload)["data"])
|
||||
ip = data["ip"]
|
||||
mac = data["mac"]
|
||||
print(ip,mac)
|
||||
print(f"时间: {time.strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
print("内容:")
|
||||
print(payload)
|
||||
if "systeminfo" in msg.topic:
|
||||
with open("mqtt_systeminfo.txt", "a+") as f:
|
||||
f.write(f"{time.strftime('%Y-%m-%d %H:%M:%S')}\n")
|
||||
f.write(f"客户端 ID: {mac}\n")
|
||||
f.write(f"\n")
|
||||
except Exception as e:
|
||||
print(f"消息解析错误: {e}")
|
||||
|
||||
|
||||
# 创建客户端
|
||||
client = mqtt.Client(CLIENT_ID)
|
||||
client.on_message = on_message
|
||||
|
||||
# 连接并订阅
|
||||
print(f"连接到 MQTT 代理: {BROKER}:{PORT}")
|
||||
client.connect(BROKER, PORT)
|
||||
for topic in TOPICs:
|
||||
client.subscribe(topic)
|
||||
print(f"已订阅主题: {TOPICs}")
|
||||
print("等待消息... (按 Ctrl+C 退出)")
|
||||
|
||||
# 保持连接
|
||||
try:
|
||||
client.loop_forever()
|
||||
except KeyboardInterrupt:
|
||||
print("\n断开连接...")
|
||||
client.disconnect()
|
||||
+85
-3
@@ -11,12 +11,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"headers = {\n",
|
||||
" \"authorization\":\"Bearer czs_h7L9OSgejkWbzwau7RfDzO35tWFNnXA3URoe1xtz1WYhyvfxDWuUTDhUGHPREjBxn\",\n",
|
||||
" \"authorization\":\"Bearer pat_OHegGl8V4T04IUBZ9KRoldFHKegGX48kQKTfyskZJWMRUbQMNHD0AuqGtvGYZ0q9\",\n",
|
||||
" \"content-type\":\"application/json\"\n",
|
||||
"}\n",
|
||||
"ip = \"https://api.coze.cn\""
|
||||
@@ -24,13 +24,61 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{\"code\":700012006,\"msg\":\"access token expired\"}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"data = post(\"https://api.coze.cn/open_api/knowledge/document/list\",headers=headers,json={\"dataset_id\":\"7567253415145144335\"}).text\n",
|
||||
"print(data)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 27,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data = get(f\"{ip}/v1/conversation/message/list?conversation_id=7483161006881980479\",json={\"limit\":20},headers=headers).json()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "AttributeError",
|
||||
"evalue": "'str' object has no attribute 'iter_lines'",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[24], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m line \u001b[38;5;129;01min\u001b[39;00m data\u001b[38;5;241m.\u001b[39miter_lines():\n\u001b[0;32m 2\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m line:\n\u001b[0;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(line\u001b[38;5;241m.\u001b[39mdecode(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mutf-8\u001b[39m\u001b[38;5;124m\"\u001b[39m))\n",
|
||||
"\u001b[1;31mAttributeError\u001b[0m: 'str' object has no attribute 'iter_lines'"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"for line in data.iter_lines():\n",
|
||||
" if line:\n",
|
||||
" print(line.decode(\"utf-8\")) # 处理每一行数据"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
@@ -238,6 +286,40 @@
|
||||
")\n",
|
||||
"print(data.text)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{\"code\":700012006,\"msg\":\"cannot get access token from Authorization header\"}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"data = post(f\"https://api.coze.cn/open_api/knowledge/document/delete\",json={\"document_ids\":[\"7567325098534502435\"]},headers=headers)\n",
|
||||
"print(data.text)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
from requests import get, post, put, delete
|
||||
import random
|
||||
|
||||
|
||||
# v1.jinrishici.com/all.json
|
||||
def apiSentence():
|
||||
data = get("https://v1.hitokoto.cn").json()
|
||||
return data
|
||||
|
||||
|
||||
def cat():
|
||||
data = get("https://api.thecatapi.com/v1/images/search?size=full").json()
|
||||
result = data[0]["url"]
|
||||
return result
|
||||
|
||||
|
||||
def dog():
|
||||
data = get("https://api.thedogapi.com/v1/images/search?size=full").json()
|
||||
result = data[0]["url"]
|
||||
return result
|
||||
|
||||
|
||||
def pic():
|
||||
data = get("https://api.vvhan.com/api/bing?type=json&rand=sj").json()
|
||||
result = data["data"]["url"]
|
||||
return result
|
||||
|
||||
|
||||
def randomPic():
|
||||
func = random.choice([cat])
|
||||
data = func()
|
||||
return data
|
||||
|
||||
|
||||
def getEmoji():
|
||||
data = get("https://api.vvhan.com/api/emoji?type=json").json()
|
||||
return data
|
||||
|
||||
|
||||
def getShi():
|
||||
data = post("http://v1.jinrishici.com/all.json").json()
|
||||
return data
|
||||
+69
-78
@@ -3,108 +3,99 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "cc3ee99d",
|
||||
"id": "39b16c44",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from requests import * "
|
||||
"from requests import get,post\n",
|
||||
"import time\n",
|
||||
"ip = \"http://192.168.0.209:8100\"\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\"{ip}/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": 42,
|
||||
"id": "5af4df03",
|
||||
"execution_count": 16,
|
||||
"id": "9f7ca2db",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for i in [\"233157541\",\"233157542\",\"233157544\",\"233157545\",\"233157546\"]:\n",
|
||||
" get(f\"http://139.159.182.121:8092/card/getTime?controllerSN={i}\")"
|
||||
"access_token = post(\"https://szihj.idsp.yunxiao.com/Open/Access/GetToken\",params={\n",
|
||||
" \"corpId\": \"869376250979578017\",\n",
|
||||
" \"corpSecret\": \"GQSYGTLMKNJHVLHZMHYDMHATIGTTOBYP\"\n",
|
||||
" }).json()\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"id": "8d2a2506",
|
||||
"execution_count": 18,
|
||||
"id": "83ed8c86",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data={\"name\":\"测试\",\"endDate\":1759161600000,\"content\":None,\"userType\":1,\"dateState\":\"0\",\"userIds\":[130,163,195,196,198,197,161,446,226,507,535,162,106,176,206,105,116,204,222,510,508,509,523,200,135,513,208,164,210,512,207,527,447,521,212,118,450,139,437,177,179,514,515,107,102,219,530,108,187,147,126,189,110,458,462,457,528,143,124,217,448,525,526,550,517,113,534,541,320,150,456,540,524,522,529,186,105,140,151,689,166,151,521,520,805,130],\"status\":0,\"type\":6,\"userName\":\"钟伟\",\"userId\":473,\"teamId\":19}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"id": "e69ccb4b",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with open(\"demo1.docx\",\"rb\") as f:\n",
|
||||
" file = f.read()"
|
||||
"token= access_token[\"access_token\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "1c7bc78e",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'{\"success\":false,\"msg\":\"文件太大\",\"code\":10004,\"data\":null}'"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"ename": "",
|
||||
"evalue": "",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m在当前单元格或上一个单元格中执行代码时 Kernel 崩溃。\n",
|
||||
"\u001b[1;31m请查看单元格中的代码,以确定故障的可能原因。\n",
|
||||
"\u001b[1;31m单击<a href='https://aka.ms/vscodeJupyterKernelCrash'>此处</a>了解详细信息。\n",
|
||||
"\u001b[1;31m有关更多详细信息,请查看 Jupyter <a href='command:jupyter.viewOutput'>log</a>。"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"post(f\"{ip}/word/process/convert\",files={\"file\":(\n",
|
||||
" \"demo1.docx\",\n",
|
||||
" file, 'application/octet-stream'\n",
|
||||
")},headers=header).text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"id": "eeed45e5",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'{\"success\":false,\"msg\":\"Transaction was marked for rollback only; cannot commit; nested exception is org.hibernate.TransactionException: Transaction was marked for rollback only; cannot commit\",\"code\":10000,\"data\":null}'"
|
||||
]
|
||||
},
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"post(f\"{ip}/applicatonTitle/add\",json=data,headers=header).text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "20286e94",
|
||||
"id": "0463e46a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
"source": [
|
||||
"HttpHeaders httpHeaders = new HttpHeaders();\n",
|
||||
" HttpEntity<String> httpEntity = new HttpEntity<String>(null, httpHeaders);\n",
|
||||
" String url = synchronizationStudentOpenByTeamIdAndType.getAddress() + \"?corpId=\" + synchronizationStudentToken.getCorpId() + \"&corpSecret=\" + synchronizationStudentToken.getCorpSecret();\n",
|
||||
" RestTemplate restTemplateHttps = new RestTemplate(RestTemplateConfig.getHttpComponentsClientHttpRequestFactory());\n",
|
||||
" ResponseEntity<String> results = restTemplateHttps.exchange(url, HttpMethod.POST, httpEntity, String.class);\n",
|
||||
" JSONObject json = JSON.parseObject(results.getBody());\n",
|
||||
" System.out.println(\"access_token-----json-----:\"+json);"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"id": "98f9d828",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"header={\n",
|
||||
" \"Authorization\": token\n",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"id": "bc1d9df5",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'{\"errcode\":0,\"errmsg\":\"ok\",\"data\":[]}'"
|
||||
]
|
||||
},
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"get(\"https://szihj.idsp.yunxiao.com/Open/Leave/GetLeaveList\",headers=header).text\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "d8bfe363",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "base",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"name": "python",
|
||||
"version": "3.12.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
@@ -1,26 +1,5 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "bc441afe",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import pandas as pd\n",
|
||||
"df = pd.read_excel('重新分班模板 (3).xlsx')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "bd93b7eb",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df.sort_values(by='新班级',inplace=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
|
||||
+3734
-1232
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,123 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "686215f8",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from requests import get,post\n",
|
||||
"import time\n",
|
||||
"ip = \"http://band.hxzhxy.cn\"\n",
|
||||
"param = {\n",
|
||||
" \"username\": \"zhongwei\",\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": 2,
|
||||
"id": "63e34092",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"ids = [36, 56,95,96,146,223,234,331,392,397,398,406,416,419,420]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "775850cb",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'36&ids=56&ids=95&ids=96&ids=146&ids=223&ids=234&ids=331&ids=392&ids=397&ids=398&ids=406&ids=416&ids=419&ids=420'"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"\"&ids=\".join([str(i) for i in ids])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "6b68dc63",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"url = 'https://www.hxzhxy.cn/hxyd-api/uc/role/grant/235?ids=36&ids=56&ids=95&ids=96&ids=146&ids=223&ids=234&ids=331&ids=392&ids=397&ids=398&ids=406&ids=416&ids=419&ids=420&access_token=a0db0a6f-0b16-4948-8d8b-4a0b6ab15f90'"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "3140ac56",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'success': True, 'msg': '操作成功', 'code': 0, 'data': None}"
|
||||
]
|
||||
},
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"ename": "",
|
||||
"evalue": "",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m在当前单元格或上一个单元格中执行代码时 Kernel 崩溃。\n",
|
||||
"\u001b[1;31m请查看单元格中的代码,以确定故障的可能原因。\n",
|
||||
"\u001b[1;31m单击<a href='https://aka.ms/vscodeJupyterKernelCrash'>此处</a>了解详细信息。\n",
|
||||
"\u001b[1;31m有关更多详细信息,请查看 Jupyter <a href='command:jupyter.viewOutput'>log</a>。"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"post(url=url,headers=header).json()"
|
||||
]
|
||||
}
|
||||
],
|
||||
"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": 5
|
||||
}
|
||||
@@ -0,0 +1,285 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "1b945caa",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from requests import get,post"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "e426f09e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"header = {\n",
|
||||
" \"Cookie\":r\"JSESSIONID=C1476EB5E872A77EF5247FB49991C59D; session=%7B%22username%22%3A%22admin%22%2C%22roleId%22%3A1%7D\"\n",
|
||||
"}\n",
|
||||
"myData={\n",
|
||||
" \"nvr34\":{\n",
|
||||
" 34020000001110000347},\n",
|
||||
" \"nvr33\":34020000001110000033,\n",
|
||||
" \"nvr35\":34020000001110000021\n",
|
||||
"}\n",
|
||||
"# nvr34= 34020000001110000347\n",
|
||||
"# nvr33 = 34020000001110000033\n",
|
||||
"nvr35 = 34020000001110000021\n",
|
||||
"data = get(f\"http://10.19.64.39:18820/api/device/query/devices/{nvr35}/channels?page=1&count=400&query=&online=&channelType=\",headers=header).json()\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"id": "7f73ee83",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'PTZType': 3,\n",
|
||||
" 'PTZTypeText': '固定枪机',\n",
|
||||
" 'address': '192.9.9.107',\n",
|
||||
" 'block': '',\n",
|
||||
" 'businessGroupId': '',\n",
|
||||
" 'certNum': '',\n",
|
||||
" 'certifiable': 0,\n",
|
||||
" 'channelId': '34020000001320000001',\n",
|
||||
" 'channelType': 0,\n",
|
||||
" 'civilCode': 'CivilCode',\n",
|
||||
" 'createTime': '',\n",
|
||||
" 'deviceId': '34020000001110000021',\n",
|
||||
" 'errCode': 0,\n",
|
||||
" 'gpsTime': '2024-04-19 11:38:33',\n",
|
||||
" 'hasAudio': False,\n",
|
||||
" 'id': 1158,\n",
|
||||
" 'ipAddress': '',\n",
|
||||
" 'latitude': 0.0,\n",
|
||||
" 'latitudeGcj02': 0.0,\n",
|
||||
" 'latitudeWgs84': 0.0,\n",
|
||||
" 'longitude': 0.0,\n",
|
||||
" 'longitudeGcj02': 0.0,\n",
|
||||
" 'longitudeWgs84': 0.0,\n",
|
||||
" 'manufacture': 'Manufacturer',\n",
|
||||
" 'model': 'Camera',\n",
|
||||
" 'name': '1楼电梯间',\n",
|
||||
" 'owner': 'Owner',\n",
|
||||
" 'parentId': '',\n",
|
||||
" 'parental': 0,\n",
|
||||
" 'password': '',\n",
|
||||
" 'port': 0,\n",
|
||||
" 'registerWay': 1,\n",
|
||||
" 'safetyWay': 0,\n",
|
||||
" 'secrecy': '0',\n",
|
||||
" 'status': 1,\n",
|
||||
" 'streamId': '',\n",
|
||||
" 'subCount': 0,\n",
|
||||
" 'updateTime': ''}"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"data[\"data\"][\"list\"][0]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"id": "749b99ed",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"192.9.9.107\n",
|
||||
"192.9.9.108\n",
|
||||
"192.9.9.109\n",
|
||||
"192.9.9.110\n",
|
||||
"192.9.9.111\n",
|
||||
"192.9.9.112\n",
|
||||
"192.9.9.113\n",
|
||||
"192.9.9.114\n",
|
||||
"192.9.9.115\n",
|
||||
"192.9.9.116\n",
|
||||
"192.9.9.117\n",
|
||||
"192.9.9.118\n",
|
||||
"192.9.9.119\n",
|
||||
"192.9.9.120\n",
|
||||
"192.9.9.121\n",
|
||||
"192.9.9.122\n",
|
||||
"192.9.9.123\n",
|
||||
"192.9.9.124\n",
|
||||
"192.9.9.125\n",
|
||||
"192.9.9.127\n",
|
||||
"192.9.9.126\n",
|
||||
"192.9.9.129\n",
|
||||
"192.9.9.128\n",
|
||||
"192.9.9.130\n",
|
||||
"192.9.9.131\n",
|
||||
"192.9.9.132\n",
|
||||
"192.9.9.133\n",
|
||||
"192.9.9.134\n",
|
||||
"192.9.9.135\n",
|
||||
"192.9.9.136\n",
|
||||
"192.9.9.137\n",
|
||||
"192.9.9.138\n",
|
||||
"192.9.9.139\n",
|
||||
"192.9.9.140\n",
|
||||
"192.9.9.141\n",
|
||||
"192.9.9.142\n",
|
||||
"192.9.9.143\n",
|
||||
"192.9.9.1\n",
|
||||
"192.9.9.144\n",
|
||||
"192.9.9.146\n",
|
||||
"192.9.9.147\n",
|
||||
"192.9.9.148\n",
|
||||
"192.9.9.149\n",
|
||||
"192.9.9.150\n",
|
||||
"192.9.9.151\n",
|
||||
"192.9.9.152\n",
|
||||
"192.9.9.153\n",
|
||||
"192.9.9.154\n",
|
||||
"192.9.9.156\n",
|
||||
"192.9.9.155\n",
|
||||
"192.9.9.158\n",
|
||||
"192.9.9.159\n",
|
||||
"192.9.9.188\n",
|
||||
"192.9.9.160\n",
|
||||
"192.9.9.161\n",
|
||||
"192.9.9.162\n",
|
||||
"192.9.9.163\n",
|
||||
"192.9.9.164\n",
|
||||
"192.9.9.165\n",
|
||||
"192.9.9.166\n",
|
||||
"192.9.9.167\n",
|
||||
"192.9.9.168\n",
|
||||
"192.9.9.169\n",
|
||||
"192.9.9.170\n",
|
||||
"192.9.9.171\n",
|
||||
"192.9.9.172\n",
|
||||
"192.9.9.173\n",
|
||||
"192.9.9.174\n",
|
||||
"192.9.9.175\n",
|
||||
"192.9.9.176\n",
|
||||
"192.9.9.177\n",
|
||||
"192.9.9.178\n",
|
||||
"192.9.9.179\n",
|
||||
"192.9.9.180\n",
|
||||
"192.9.9.181\n",
|
||||
"192.9.9.182\n",
|
||||
"192.9.9.183\n",
|
||||
"192.9.9.184\n",
|
||||
"192.9.9.185\n",
|
||||
"192.9.9.186\n",
|
||||
"192.9.9.187\n",
|
||||
"192.9.9.189\n",
|
||||
"192.9.9.190\n",
|
||||
"192.9.9.191\n",
|
||||
"192.9.9.192\n",
|
||||
"192.9.9.193\n",
|
||||
"192.9.9.194\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"0.0.0.0\n",
|
||||
"Address\n",
|
||||
"Address\n",
|
||||
"Address\n",
|
||||
"Address\n",
|
||||
"Address\n",
|
||||
"Address\n",
|
||||
"Address\n",
|
||||
"Address\n",
|
||||
"Address\n",
|
||||
"Address\n",
|
||||
"Address\n",
|
||||
"Address\n",
|
||||
"Address\n",
|
||||
"Address\n",
|
||||
"Address\n",
|
||||
"Address\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"for item in data[\"data\"][\"list\"]:\n",
|
||||
" print(item[\"address\"])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "b3eca058",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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": 5
|
||||
}
|
||||
+10
-29
@@ -29,44 +29,25 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": null,
|
||||
"id": "3c046d8d",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<html>\n",
|
||||
"<head><title>404 Not Found</title></head>\n",
|
||||
"<body bgcolor=\"white\">\n",
|
||||
"<center><h1>404 Not Found</h1></center>\n",
|
||||
"<hr><center>nginx/1.4.0</center>\n",
|
||||
"</body>\n",
|
||||
"</html>\n",
|
||||
"\n",
|
||||
"<html>\n",
|
||||
"<head><title>404 Not Found</title></head>\n",
|
||||
"<body bgcolor=\"white\">\n",
|
||||
"<center><h1>404 Not Found</h1></center>\n",
|
||||
"<hr><center>nginx/1.4.0</center>\n",
|
||||
"</body>\n",
|
||||
"</html>\n",
|
||||
"\n",
|
||||
"<html>\n",
|
||||
"<head><title>404 Not Found</title></head>\n",
|
||||
"<body bgcolor=\"white\">\n",
|
||||
"<center><h1>404 Not Found</h1></center>\n",
|
||||
"<hr><center>nginx/1.4.0</center>\n",
|
||||
"</body>\n",
|
||||
"</html>\n",
|
||||
"\n"
|
||||
"ename": "",
|
||||
"evalue": "",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m在当前单元格或上一个单元格中执行代码时 Kernel 崩溃。\n",
|
||||
"\u001b[1;31m请查看单元格中的代码,以确定故障的可能原因。\n",
|
||||
"\u001b[1;31m单击<a href='https://aka.ms/vscodeJupyterKernelCrash'>此处</a>了解详细信息。\n",
|
||||
"\u001b[1;31m有关更多详细信息,请查看 Jupyter <a href='command:jupyter.viewOutput'>log</a>。"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"for i in range(24,27):\n",
|
||||
" print(post(f\"{ip}/classAttendStu/createThisWeek\",headers=header,params={\"planId\":i},timeout=600).text)"
|
||||
" post(f\"{ip}/classAttendStu/createThisWeek\",headers=header,params={\"planId\":i},timeout=600).text"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "16e6d922",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from requests import get,post\n",
|
||||
"import pandas as pd\n",
|
||||
"import time\n",
|
||||
"teamId = 19\n",
|
||||
"ip = \"http://band.hxzhxy.cn\"\n",
|
||||
"param = {\n",
|
||||
" \"username\": \"zhongwei\",\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": 2,
|
||||
"id": "e2f2a890",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"#25届\n",
|
||||
"studentInfos = get(f\"https://www.hxzhxy.cn/hxyd-api/uc/student/pageInfo?teamId=19&gradeId=124&type=0&pageSize=500&pageNumber=0&orderDirection=asc&access_token={token}\").json()[\"data\"][\"content\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "d7d3c7b0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# studentInfos = get(f\"https://www.hxzhxy.cn/hxyd-api/uc/student/pageInfo?teamId=19&gradeId=120&name=&type=0&pageSize=30&pageNumber=1&orderDirection=asc&access_token={token}\").json()[\"data\"][\"content\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"id": "49b6ff40",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import time\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 34,
|
||||
"id": "77ce4d27",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def getSportInfo(wristbandNo):\n",
|
||||
" my_time = time.time()*1000\n",
|
||||
" res = get(f\"{ip}/parent/band/day\",params={\n",
|
||||
" \"date\":1762504686000,\n",
|
||||
" \"wristbandNo\":wristbandNo,\n",
|
||||
" },headers=header).json()\n",
|
||||
" print(res)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "fbe938af",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"白芮羽 未改密码,0个联系方式未绑定\n",
|
||||
"白宇强 未改密码,0个联系方式未绑定\n",
|
||||
"曾妙涵 未改密码,0个联系方式未绑定\n",
|
||||
"曾奕璟 未改密码,1个联系方式未绑定\n",
|
||||
"陈佳逸 未改密码,2个联系方式未绑定\n",
|
||||
"陈奕冰 未改密码,1个联系方式未绑定\n",
|
||||
"陈雨泽 未改密码,0个联系方式未绑定\n",
|
||||
"程彦萌 未改密码,0个联系方式未绑定\n",
|
||||
"崔绪程 未改密码,1个联系方式未绑定\n",
|
||||
"邓馨怡 未改密码,1个联系方式未绑定\n",
|
||||
"邓雅心 未改密码,0个联系方式未绑定\n",
|
||||
"丁晨曦 未改密码,0个联系方式未绑定\n",
|
||||
"董思淇 未改密码,0个联系方式未绑定\n",
|
||||
"董思睿 未改密码,1个联系方式未绑定\n",
|
||||
"段梓锽 未改密码,1个联系方式未绑定\n",
|
||||
"樊子妘 未改密码,1个联系方式未绑定\n",
|
||||
"樊梓皓 未改密码,1个联系方式未绑定\n",
|
||||
"方一渊 未改密码,1个联系方式未绑定\n",
|
||||
"付琦宁 未改密码,0个联系方式未绑定\n",
|
||||
"甘浩源 未改密码,1个联系方式未绑定\n",
|
||||
"高竟然 未改密码,1个联系方式未绑定\n",
|
||||
"苟语欣 未改密码,0个联系方式未绑定\n",
|
||||
"苟紫阳 未改密码,0个联系方式未绑定\n",
|
||||
"何柏翰 未改密码,0个联系方式未绑定\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ename": "KeyboardInterrupt",
|
||||
"evalue": "",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[4], line 4\u001b[0m\n\u001b[0;32m 2\u001b[0m userName \u001b[38;5;241m=\u001b[39m stu[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124muserName\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[0;32m 3\u001b[0m stuNo\u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mstu[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mstuNo\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124ma\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m----> 4\u001b[0m res \u001b[38;5;241m=\u001b[39m get(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mip\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m/oauth/token?username=\u001b[39m\u001b[38;5;132;01m{\u001b[39;00muserName\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m&password=\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mstuNo\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m&client_id=client&grant_type=password&client_secret=123456\u001b[39m\u001b[38;5;124m\"\u001b[39m)\u001b[38;5;241m.\u001b[39mjson()\n\u001b[0;32m 5\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m res\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124maccess_token\u001b[39m\u001b[38;5;124m\"\u001b[39m,\u001b[38;5;28;01mFalse\u001b[39;00m) \u001b[38;5;129;01mand\u001b[39;00m stu[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtype\u001b[39m\u001b[38;5;124m\"\u001b[39m]\u001b[38;5;241m==\u001b[39m\u001b[38;5;241m5\u001b[39m:\n\u001b[0;32m 6\u001b[0m count \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m2\u001b[39m\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\requests\\api.py:73\u001b[0m, in \u001b[0;36mget\u001b[1;34m(url, params, **kwargs)\u001b[0m\n\u001b[0;32m 62\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mget\u001b[39m(url, params\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[0;32m 63\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124mr\u001b[39m\u001b[38;5;124;03m\"\"\"Sends a GET request.\u001b[39;00m\n\u001b[0;32m 64\u001b[0m \n\u001b[0;32m 65\u001b[0m \u001b[38;5;124;03m :param url: URL for the new :class:`Request` object.\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 70\u001b[0m \u001b[38;5;124;03m :rtype: requests.Response\u001b[39;00m\n\u001b[0;32m 71\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m---> 73\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m request(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mget\u001b[39m\u001b[38;5;124m\"\u001b[39m, url, params\u001b[38;5;241m=\u001b[39mparams, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\requests\\api.py:59\u001b[0m, in \u001b[0;36mrequest\u001b[1;34m(method, url, **kwargs)\u001b[0m\n\u001b[0;32m 55\u001b[0m \u001b[38;5;66;03m# By using the 'with' statement we are sure the session is closed, thus we\u001b[39;00m\n\u001b[0;32m 56\u001b[0m \u001b[38;5;66;03m# avoid leaving sockets open which can trigger a ResourceWarning in some\u001b[39;00m\n\u001b[0;32m 57\u001b[0m \u001b[38;5;66;03m# cases, and look like a memory leak in others.\u001b[39;00m\n\u001b[0;32m 58\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m sessions\u001b[38;5;241m.\u001b[39mSession() \u001b[38;5;28;01mas\u001b[39;00m session:\n\u001b[1;32m---> 59\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m session\u001b[38;5;241m.\u001b[39mrequest(method\u001b[38;5;241m=\u001b[39mmethod, url\u001b[38;5;241m=\u001b[39murl, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\requests\\sessions.py:589\u001b[0m, in \u001b[0;36mSession.request\u001b[1;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[0;32m 584\u001b[0m send_kwargs \u001b[38;5;241m=\u001b[39m {\n\u001b[0;32m 585\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtimeout\u001b[39m\u001b[38;5;124m\"\u001b[39m: timeout,\n\u001b[0;32m 586\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mallow_redirects\u001b[39m\u001b[38;5;124m\"\u001b[39m: allow_redirects,\n\u001b[0;32m 587\u001b[0m }\n\u001b[0;32m 588\u001b[0m send_kwargs\u001b[38;5;241m.\u001b[39mupdate(settings)\n\u001b[1;32m--> 589\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msend(prep, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39msend_kwargs)\n\u001b[0;32m 591\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m resp\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\requests\\sessions.py:703\u001b[0m, in \u001b[0;36mSession.send\u001b[1;34m(self, request, **kwargs)\u001b[0m\n\u001b[0;32m 700\u001b[0m start \u001b[38;5;241m=\u001b[39m preferred_clock()\n\u001b[0;32m 702\u001b[0m \u001b[38;5;66;03m# Send the request\u001b[39;00m\n\u001b[1;32m--> 703\u001b[0m r \u001b[38;5;241m=\u001b[39m adapter\u001b[38;5;241m.\u001b[39msend(request, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[0;32m 705\u001b[0m \u001b[38;5;66;03m# Total elapsed time of the request (approximately)\u001b[39;00m\n\u001b[0;32m 706\u001b[0m elapsed \u001b[38;5;241m=\u001b[39m preferred_clock() \u001b[38;5;241m-\u001b[39m start\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\requests\\adapters.py:589\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[1;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[0;32m 586\u001b[0m timeout \u001b[38;5;241m=\u001b[39m TimeoutSauce(connect\u001b[38;5;241m=\u001b[39mtimeout, read\u001b[38;5;241m=\u001b[39mtimeout)\n\u001b[0;32m 588\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 589\u001b[0m resp \u001b[38;5;241m=\u001b[39m conn\u001b[38;5;241m.\u001b[39murlopen(\n\u001b[0;32m 590\u001b[0m method\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mmethod,\n\u001b[0;32m 591\u001b[0m url\u001b[38;5;241m=\u001b[39murl,\n\u001b[0;32m 592\u001b[0m body\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mbody,\n\u001b[0;32m 593\u001b[0m headers\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mheaders,\n\u001b[0;32m 594\u001b[0m redirect\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 595\u001b[0m assert_same_host\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 596\u001b[0m preload_content\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 597\u001b[0m decode_content\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m,\n\u001b[0;32m 598\u001b[0m retries\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmax_retries,\n\u001b[0;32m 599\u001b[0m timeout\u001b[38;5;241m=\u001b[39mtimeout,\n\u001b[0;32m 600\u001b[0m chunked\u001b[38;5;241m=\u001b[39mchunked,\n\u001b[0;32m 601\u001b[0m )\n\u001b[0;32m 603\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (ProtocolError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[0;32m 604\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(err, request\u001b[38;5;241m=\u001b[39mrequest)\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\urllib3\\connectionpool.py:787\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[1;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[0m\n\u001b[0;32m 784\u001b[0m response_conn \u001b[38;5;241m=\u001b[39m conn \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m release_conn \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m 786\u001b[0m \u001b[38;5;66;03m# Make the request on the HTTPConnection object\u001b[39;00m\n\u001b[1;32m--> 787\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_make_request(\n\u001b[0;32m 788\u001b[0m conn,\n\u001b[0;32m 789\u001b[0m method,\n\u001b[0;32m 790\u001b[0m url,\n\u001b[0;32m 791\u001b[0m timeout\u001b[38;5;241m=\u001b[39mtimeout_obj,\n\u001b[0;32m 792\u001b[0m body\u001b[38;5;241m=\u001b[39mbody,\n\u001b[0;32m 793\u001b[0m headers\u001b[38;5;241m=\u001b[39mheaders,\n\u001b[0;32m 794\u001b[0m chunked\u001b[38;5;241m=\u001b[39mchunked,\n\u001b[0;32m 795\u001b[0m retries\u001b[38;5;241m=\u001b[39mretries,\n\u001b[0;32m 796\u001b[0m response_conn\u001b[38;5;241m=\u001b[39mresponse_conn,\n\u001b[0;32m 797\u001b[0m preload_content\u001b[38;5;241m=\u001b[39mpreload_content,\n\u001b[0;32m 798\u001b[0m decode_content\u001b[38;5;241m=\u001b[39mdecode_content,\n\u001b[0;32m 799\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mresponse_kw,\n\u001b[0;32m 800\u001b[0m )\n\u001b[0;32m 802\u001b[0m \u001b[38;5;66;03m# Everything went great!\u001b[39;00m\n\u001b[0;32m 803\u001b[0m clean_exit \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\urllib3\\connectionpool.py:493\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[1;34m(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)\u001b[0m\n\u001b[0;32m 490\u001b[0m \u001b[38;5;66;03m# conn.request() calls http.client.*.request, not the method in\u001b[39;00m\n\u001b[0;32m 491\u001b[0m \u001b[38;5;66;03m# urllib3.request. It also calls makefile (recv) on the socket.\u001b[39;00m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 493\u001b[0m conn\u001b[38;5;241m.\u001b[39mrequest(\n\u001b[0;32m 494\u001b[0m method,\n\u001b[0;32m 495\u001b[0m url,\n\u001b[0;32m 496\u001b[0m body\u001b[38;5;241m=\u001b[39mbody,\n\u001b[0;32m 497\u001b[0m headers\u001b[38;5;241m=\u001b[39mheaders,\n\u001b[0;32m 498\u001b[0m chunked\u001b[38;5;241m=\u001b[39mchunked,\n\u001b[0;32m 499\u001b[0m preload_content\u001b[38;5;241m=\u001b[39mpreload_content,\n\u001b[0;32m 500\u001b[0m decode_content\u001b[38;5;241m=\u001b[39mdecode_content,\n\u001b[0;32m 501\u001b[0m enforce_content_length\u001b[38;5;241m=\u001b[39menforce_content_length,\n\u001b[0;32m 502\u001b[0m )\n\u001b[0;32m 504\u001b[0m \u001b[38;5;66;03m# We are swallowing BrokenPipeError (errno.EPIPE) since the server is\u001b[39;00m\n\u001b[0;32m 505\u001b[0m \u001b[38;5;66;03m# legitimately able to close the connection after sending a valid response.\u001b[39;00m\n\u001b[0;32m 506\u001b[0m \u001b[38;5;66;03m# With this behaviour, the received response is still readable.\u001b[39;00m\n\u001b[0;32m 507\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mBrokenPipeError\u001b[39;00m:\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\urllib3\\connection.py:494\u001b[0m, in \u001b[0;36mHTTPConnection.request\u001b[1;34m(self, method, url, body, headers, chunked, preload_content, decode_content, enforce_content_length)\u001b[0m\n\u001b[0;32m 492\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m header, value \u001b[38;5;129;01min\u001b[39;00m headers\u001b[38;5;241m.\u001b[39mitems():\n\u001b[0;32m 493\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mputheader(header, value)\n\u001b[1;32m--> 494\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mendheaders()\n\u001b[0;32m 496\u001b[0m \u001b[38;5;66;03m# If we're given a body we start sending that in chunks.\u001b[39;00m\n\u001b[0;32m 497\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m chunks \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\http\\client.py:1331\u001b[0m, in \u001b[0;36mHTTPConnection.endheaders\u001b[1;34m(self, message_body, encode_chunked)\u001b[0m\n\u001b[0;32m 1329\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 1330\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m CannotSendHeader()\n\u001b[1;32m-> 1331\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_send_output(message_body, encode_chunked\u001b[38;5;241m=\u001b[39mencode_chunked)\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\http\\client.py:1091\u001b[0m, in \u001b[0;36mHTTPConnection._send_output\u001b[1;34m(self, message_body, encode_chunked)\u001b[0m\n\u001b[0;32m 1089\u001b[0m msg \u001b[38;5;241m=\u001b[39m \u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;130;01m\\r\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_buffer)\n\u001b[0;32m 1090\u001b[0m \u001b[38;5;28;01mdel\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_buffer[:]\n\u001b[1;32m-> 1091\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msend(msg)\n\u001b[0;32m 1093\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m message_body \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 1094\u001b[0m \n\u001b[0;32m 1095\u001b[0m \u001b[38;5;66;03m# create a consistent interface to message_body\u001b[39;00m\n\u001b[0;32m 1096\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mhasattr\u001b[39m(message_body, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mread\u001b[39m\u001b[38;5;124m'\u001b[39m):\n\u001b[0;32m 1097\u001b[0m \u001b[38;5;66;03m# Let file-like take precedence over byte-like. This\u001b[39;00m\n\u001b[0;32m 1098\u001b[0m \u001b[38;5;66;03m# is needed to allow the current position of mmap'ed\u001b[39;00m\n\u001b[0;32m 1099\u001b[0m \u001b[38;5;66;03m# files to be taken into account.\u001b[39;00m\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\http\\client.py:1035\u001b[0m, in \u001b[0;36mHTTPConnection.send\u001b[1;34m(self, data)\u001b[0m\n\u001b[0;32m 1033\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msock \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 1034\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mauto_open:\n\u001b[1;32m-> 1035\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconnect()\n\u001b[0;32m 1036\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 1037\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m NotConnected()\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\urllib3\\connection.py:325\u001b[0m, in \u001b[0;36mHTTPConnection.connect\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 324\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mconnect\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m--> 325\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msock \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_new_conn()\n\u001b[0;32m 326\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_tunnel_host:\n\u001b[0;32m 327\u001b[0m \u001b[38;5;66;03m# If we're tunneling it means we're connected to our proxy.\u001b[39;00m\n\u001b[0;32m 328\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_has_connected_to_proxy \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\urllib3\\connection.py:198\u001b[0m, in \u001b[0;36mHTTPConnection._new_conn\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 193\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Establish a socket connection and set nodelay settings on it.\u001b[39;00m\n\u001b[0;32m 194\u001b[0m \n\u001b[0;32m 195\u001b[0m \u001b[38;5;124;03m:return: New socket connection.\u001b[39;00m\n\u001b[0;32m 196\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 197\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m--> 198\u001b[0m sock \u001b[38;5;241m=\u001b[39m connection\u001b[38;5;241m.\u001b[39mcreate_connection(\n\u001b[0;32m 199\u001b[0m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_dns_host, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mport),\n\u001b[0;32m 200\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtimeout,\n\u001b[0;32m 201\u001b[0m source_address\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msource_address,\n\u001b[0;32m 202\u001b[0m socket_options\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msocket_options,\n\u001b[0;32m 203\u001b[0m )\n\u001b[0;32m 204\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m socket\u001b[38;5;241m.\u001b[39mgaierror \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m 205\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m NameResolutionError(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhost, \u001b[38;5;28mself\u001b[39m, e) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01me\u001b[39;00m\n",
|
||||
"File \u001b[1;32md:\\Anaconda3\\Lib\\site-packages\\urllib3\\util\\connection.py:73\u001b[0m, in \u001b[0;36mcreate_connection\u001b[1;34m(address, timeout, source_address, socket_options)\u001b[0m\n\u001b[0;32m 71\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m source_address:\n\u001b[0;32m 72\u001b[0m sock\u001b[38;5;241m.\u001b[39mbind(source_address)\n\u001b[1;32m---> 73\u001b[0m sock\u001b[38;5;241m.\u001b[39mconnect(sa)\n\u001b[0;32m 74\u001b[0m \u001b[38;5;66;03m# Break explicitly a reference cycle\u001b[39;00m\n\u001b[0;32m 75\u001b[0m err \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n",
|
||||
"\u001b[1;31mKeyboardInterrupt\u001b[0m: "
|
||||
]
|
||||
},
|
||||
{
|
||||
"ename": "",
|
||||
"evalue": "",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m在当前单元格或上一个单元格中执行代码时 Kernel 崩溃。\n",
|
||||
"\u001b[1;31m请查看单元格中的代码,以确定故障的可能原因。\n",
|
||||
"\u001b[1;31m单击<a href='https://aka.ms/vscodeJupyterKernelCrash'>此处</a>了解详细信息。\n",
|
||||
"\u001b[1;31m有关更多详细信息,请查看 Jupyter <a href='command:jupyter.viewOutput'>log</a>。"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"for stu in studentInfos:\n",
|
||||
" userName = stu['userName']\n",
|
||||
" stuNo= f\"{stu['stuNo']}a\"\n",
|
||||
" res = get(f\"{ip}/oauth/token?username={userName}&password={stuNo}&client_id=client&grant_type=password&client_secret=123456\").json()\n",
|
||||
" if res.get(\"access_token\",False) and stu[\"type\"]==5:\n",
|
||||
" count = 2\n",
|
||||
" if stu[\"wxPhone\"]:\n",
|
||||
" count-=1\n",
|
||||
" if stu[\"wxPhones\"]:\n",
|
||||
" count-=1\n",
|
||||
" \n",
|
||||
" print(f\"{stu['stuName']} 未改密码,{count}个联系方式未绑定\")\n",
|
||||
" # getSportInfo(stu[\"seralNo\"])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "772377e5",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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": 5
|
||||
}
|
||||
+107
-31
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 59,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 60,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -28,7 +28,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 61,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -37,7 +37,7 @@
|
||||
"0"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"execution_count": 61,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -65,16 +65,16 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 62,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x2208bc58860>"
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x250160b7bf0>"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"execution_count": 62,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -85,7 +85,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 63,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -94,7 +94,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 64,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -103,16 +103,28 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 72,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "KeyError",
|
||||
"evalue": "'data'",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[72], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m records \u001b[38;5;241m=\u001b[39m get(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mip\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m/school/devices/listPage?temaId=19&groupId=0&pageNum=1&pageSize=40\u001b[39m\u001b[38;5;124m\"\u001b[39m,headers\u001b[38;5;241m=\u001b[39mheaders)\u001b[38;5;241m.\u001b[39mjson()[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdata\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrecords\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n",
|
||||
"\u001b[1;31mKeyError\u001b[0m: 'data'"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"records = get(f\"{ip}/school/devices/listPage?temaId=19&groupId=0&pageNum=1&pageSize=40\",headers=headers).json()[\"data\"][\"records\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 73,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -123,7 +135,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 74,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -139,16 +151,16 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 75,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"19"
|
||||
"27"
|
||||
]
|
||||
},
|
||||
"execution_count": 11,
|
||||
"execution_count": 75,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -159,16 +171,16 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 69,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"15"
|
||||
"6"
|
||||
]
|
||||
},
|
||||
"execution_count": 12,
|
||||
"execution_count": 69,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -306,12 +318,11 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 45,
|
||||
"execution_count": 81,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for index,item in enumerate(macs):\n",
|
||||
" time.sleep(1)\n",
|
||||
" topic = f\"cmd/publicizeTelevision/{item}/dog\"\n",
|
||||
" message = {\"name\":\"watchDog.exe\",\"url\":\"http://schoolserver.com:9008/common/download/app/watchDog.exe\",\"type\":\"down\"}\n",
|
||||
" client.publish(topic,json.dumps(message,ensure_ascii=False))"
|
||||
@@ -319,24 +330,50 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# for index,item in enumerate(macs):\n",
|
||||
"# time.sleep(1)\n",
|
||||
"# topic = f\"cmd/publicizeTelevision/{item}/dog\"\n",
|
||||
"# message = {\"name\":\"watchDog.exe\",\"url\":\"http://schoolserver.com:9008/common/download/app/HEU.exe\",\"type\":\"down\"}\n",
|
||||
"# client.publish(topic,json.dumps(message,ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 76,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for index,item in enumerate(macs):\n",
|
||||
" time.sleep(1)\n",
|
||||
" topic = f\"cmd/publicizeTelevision/{item}/dog\"\n",
|
||||
" message = {\"type\":\"stop\"}\n",
|
||||
" client.publish(topic,json.dumps(message,ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x2015292bfb0>"
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x250130fca90>"
|
||||
]
|
||||
},
|
||||
"execution_count": 30,
|
||||
"execution_count": 79,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"topic = f\"cmd/publicizeTelevision/000c290a0fcb/dog\"\n",
|
||||
"message = {\"name\":\"watchDog.exe\",\"url\":\"http://schoolserver.com:9008/common/download/app/watchDog.exe\",\"type\":\"down\"}\n",
|
||||
"client.publish(topic,json.dumps(message,ensure_ascii=False))"
|
||||
"# topic = f\"cmd/publicizeTelevision/00e066fd8989/dog\"\n",
|
||||
"# message = {\"name\":\"watchDog.exe\",\"url\":\"http://schoolserver.com:9008/common/download/app/watchDog.exe\",\"type\":\"down\"}\n",
|
||||
"# client.publish(topic,json.dumps(message,ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -365,7 +402,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -375,6 +412,30 @@
|
||||
" client.publish(topic,message)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 49,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/publicizeTelevision/{item}/cmd\"\n",
|
||||
" message = \"shutdown /r\"\n",
|
||||
" client.publish(topic,message)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 48,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/publicizeTelevision/{item}/cmd\"\n",
|
||||
" message = '''taskkill /f /t /im watchDog.exe'''\n",
|
||||
" client.publish(topic,message)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
@@ -384,7 +445,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -509,7 +570,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 90,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -517,7 +578,22 @@
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/televisionDog/{item.upper()}/common\"\n",
|
||||
" message = {\n",
|
||||
" \"common\":[\"tasklist | findstr \\\"校宣机程序\\\"\"]\n",
|
||||
" \"common\":[\"shutdown /r \"]\n",
|
||||
"}\n",
|
||||
" client.publish(topic,json.dumps(message, ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 80,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/televisionDog/{item.upper()}/control\"\n",
|
||||
" message = {\n",
|
||||
" \"type\":\"capture\",\n",
|
||||
" \"id\":\"1\",\n",
|
||||
"}\n",
|
||||
" client.publish(topic,json.dumps(message, ensure_ascii=False))"
|
||||
]
|
||||
|
||||
+90
-71
@@ -9,9 +9,10 @@
|
||||
"source": [
|
||||
"from requests import get,post\n",
|
||||
"import time\n",
|
||||
"import json\n",
|
||||
"ip = \"http://band.hxzhxy.cn\"\n",
|
||||
"param = {\n",
|
||||
" \"username\": \"tangchao\",\n",
|
||||
" \"username\": \"zhongwei\",\n",
|
||||
" \"password\": \"123456a\",\n",
|
||||
" \"client_id\": \"client\",\n",
|
||||
" \"grant_type\": \"password\",\n",
|
||||
@@ -22,14 +23,62 @@
|
||||
"header = {\n",
|
||||
" \"content-type\": \"application/json\",\n",
|
||||
" \"authorization\": f\"Bearer {token}\",\n",
|
||||
"}\n",
|
||||
"teamId=110"
|
||||
"}\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "87b0a73c",
|
||||
"execution_count": 30,
|
||||
"id": "e4f5ed31",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"9e6e0e24-67fd-4b7c-802a-b204ff4ca95c\n",
|
||||
"{'success': True, 'msg': '操作成功', 'code': 0, 'data': {'id': 475, 'pwd': '{bcrypt}$2a$10$K7EdytUGmdkfGn.zvLlg3O62TV5hCptj83MGbweHK0jSw8kzZPZ2m', 'locked': False, 'enabled': True, 'role': {'id': 168, 'roleName': '鸿兴演示中学家长', 'description': None, 'priority': 10, 'createTime': 1622713421000, 'updateTime': 1659193585000, 'teamId': 106, 'type': 1}, 'teamId': 106, 'type': 3, 'authorities': [{'authority': '鸿兴演示中学家长'}], 'username': 'jz97621', 'password': '{bcrypt}$2a$10$K7EdytUGmdkfGn.zvLlg3O62TV5hCptj83MGbweHK0jSw8kzZPZ2m', 'accountNonExpired': True, 'accountNonLocked': True, 'credentialsNonExpired': True}}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"param={\n",
|
||||
" \"username\": 17307283669,\n",
|
||||
" \"password\": \"jz97621\",\n",
|
||||
" \"client_id\": \"client\",\n",
|
||||
" \"grant_type\": \"password\",\n",
|
||||
" \"client_secret\": \"123456\",\n",
|
||||
" \"login_type\": \"PHONE_USERNAME\"\n",
|
||||
"}\n",
|
||||
"token = get(\"https://band.hxzhxy.cn/oauth/token\",params=param).json()[\"access_token\"]\n",
|
||||
"print(token)\n",
|
||||
"data = get(f\"https://band.hxzhxy.cn/uc/account/current?access_token={token}\").json()\n",
|
||||
"print(data)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 33,
|
||||
"id": "b9c253b1",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"fab765b1-46f0-4e2a-816b-ebdeb9d31cdf\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"access_token=get(\"https://band.hxzhxy.cn/oauth/token?username=17307283669&password=2019240217HXYSZX&client_id=client&grant_type=password&client_secret=123456&login_type=PHONE_USERNAME\").json()[\"access_token\"]\n",
|
||||
"print(access_token)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 32,
|
||||
"id": "9136ed38",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -38,90 +87,60 @@
|
||||
"{'success': True,\n",
|
||||
" 'msg': '操作成功',\n",
|
||||
" 'code': 0,\n",
|
||||
" 'data': {'id': 10914,\n",
|
||||
" 'stuNo': '25040057',\n",
|
||||
" 'stuName': '冯梓骏',\n",
|
||||
" 'sex': 1,\n",
|
||||
" 'classId': 499,\n",
|
||||
" 'gradeId': 129,\n",
|
||||
" 'seralNo': '3108683745',\n",
|
||||
" 'score': 'A',\n",
|
||||
" 'moralEducation': 'A',\n",
|
||||
" 'userName': '25040057CDSPTSZXBRFX',\n",
|
||||
" 'teamId': 110,\n",
|
||||
" 'pid': None,\n",
|
||||
" 'phone': None,\n",
|
||||
" 'imgUrl': None,\n",
|
||||
" 'openid': None,\n",
|
||||
" 'boarder': 2,\n",
|
||||
" 'wxPhone': '13540808459',\n",
|
||||
" 'trust': 0,\n",
|
||||
" 'userId': None,\n",
|
||||
" 'stature': None,\n",
|
||||
" 'weight': None,\n",
|
||||
" 'wxPhones': None,\n",
|
||||
" 'userIdse': None,\n",
|
||||
" 'payUserId': '25082816140601002478',\n",
|
||||
" 'payState': 3,\n",
|
||||
" 'teaChild': 0,\n",
|
||||
" 'openids': None,\n",
|
||||
" 'casId': None,\n",
|
||||
" 'board': 1,\n",
|
||||
" 'chatOpenId': None,\n",
|
||||
" 'chatOpenIds': None,\n",
|
||||
" 'teamName': None,\n",
|
||||
" 'gradeName': '2025级',\n",
|
||||
" 'className': '导师11班',\n",
|
||||
" 'sexName': None,\n",
|
||||
" 'battery': None,\n",
|
||||
" 'steps': None,\n",
|
||||
" 'rank': None,\n",
|
||||
" 'roleName': None,\n",
|
||||
" 'sleepStart': None,\n",
|
||||
" 'sleepEnd': None,\n",
|
||||
" 'type': None,\n",
|
||||
" 'setTime': None,\n",
|
||||
" 'status': None,\n",
|
||||
" 'userType': None,\n",
|
||||
" 'sumLocation': None,\n",
|
||||
" 'arkName': None}}"
|
||||
" 'data': {'id': 5454,\n",
|
||||
" 'pwd': '{bcrypt}$2a$10$I66PBUWdeoWYh/FcGfhB1O2T1a8NJOpFB8YVZtScmH3YO7tNzuSBm',\n",
|
||||
" 'locked': False,\n",
|
||||
" 'enabled': True,\n",
|
||||
" 'role': {'id': 168,\n",
|
||||
" 'roleName': '鸿兴演示中学家长',\n",
|
||||
" 'description': None,\n",
|
||||
" 'priority': 10,\n",
|
||||
" 'createTime': 1622713421000,\n",
|
||||
" 'updateTime': 1659193585000,\n",
|
||||
" 'teamId': 106,\n",
|
||||
" 'type': 1},\n",
|
||||
" 'teamId': 106,\n",
|
||||
" 'type': 3,\n",
|
||||
" 'authorities': [{'authority': '鸿兴演示中学家长'}],\n",
|
||||
" 'username': '2019240217HXYSZX',\n",
|
||||
" 'password': '{bcrypt}$2a$10$I66PBUWdeoWYh/FcGfhB1O2T1a8NJOpFB8YVZtScmH3YO7tNzuSBm',\n",
|
||||
" 'accountNonExpired': True,\n",
|
||||
" 'accountNonLocked': True,\n",
|
||||
" 'credentialsNonExpired': True}}"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"execution_count": 32,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"ename": "",
|
||||
"evalue": "",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m在当前单元格或上一个单元格中执行代码时 Kernel 崩溃。\n",
|
||||
"\u001b[1;31m请查看单元格中的代码,以确定故障的可能原因。\n",
|
||||
"\u001b[1;31m单击<a href='https://aka.ms/vscodeJupyterKernelCrash'>此处</a>了解详细信息。\n",
|
||||
"\u001b[1;31m有关更多详细信息,请查看 Jupyter <a href='command:jupyter.viewOutput'>log</a>。"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"get(f\"{ip}/uc/student/findBySerialNo\",params={\n",
|
||||
" \"teamId\":teamId,\n",
|
||||
" \"param\":\"3108683745\"\n",
|
||||
"},headers=header).json()"
|
||||
"get(f\"https://band.hxzhxy.cn/uc/account/current?access_token={access_token}\").json()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "96366a8b",
|
||||
"id": "ffcb6b87",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'success': False, 'msg': '非法访问,没有认证', 'code': 10007, 'data': None}"
|
||||
]
|
||||
},
|
||||
"execution_count": 27,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "base",
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
||||
+630
-825
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,74 @@
|
||||
# %%
|
||||
from requests import get,post
|
||||
import time
|
||||
import json
|
||||
ip = "http://band.hxzhxy.cn"
|
||||
param = {
|
||||
"username": "tangchao",
|
||||
"password": "123456a",
|
||||
"client_id": "client",
|
||||
"grant_type": "password",
|
||||
"client_secret": "123456",
|
||||
}
|
||||
data = get(url=f"http://band.hxzhxy.cn/oauth/token?username=zhongwei&password=123456a&client_id=client&grant_type=password&client_secret=123456").json()
|
||||
token = data["access_token"]
|
||||
header = {
|
||||
"content-type": "application/json",
|
||||
"authorization": f"Bearer {token}",
|
||||
}
|
||||
# http://139.159.182.121:8092/card/findUser?bandNo=0269414644&controllerSN=233159158
|
||||
data = get(f"https://band.hxzhxy.cn/card/listStuWithRule?gradeId=&classId=&screen=0¶m=&board=&type=1¤tPage=1&pageNumber=0&pageSize=1000&pageTotal=593&teamId=110",headers=header).json()
|
||||
stus2 = data["data"]["listData"]
|
||||
# %%
|
||||
incorrect_students = []
|
||||
|
||||
for stu in stus2:
|
||||
night_study = stu['晚自习']
|
||||
band_no = stu['手环号']
|
||||
|
||||
url = f"http://139.159.182.121:8092/card/findUser?bandNo={band_no}&controllerSN=233159164"
|
||||
|
||||
try:
|
||||
response = get(url)
|
||||
result = response.json()
|
||||
|
||||
if result.get('success') and result.get('msg'):
|
||||
try:
|
||||
msg_data = json.loads(result['msg'])
|
||||
permissions = msg_data.get('result', {}).get('权限', [])
|
||||
|
||||
if permissions:
|
||||
permission = permissions[0]
|
||||
door1_time = permission.get('1号门控制时段', -1)
|
||||
|
||||
expected_time = 9 if night_study == 2 else 16
|
||||
|
||||
if door1_time != expected_time:
|
||||
incorrect_students.append({
|
||||
'姓名': stu.get('姓名', '未知'),
|
||||
'手环号': band_no,
|
||||
'晚自习': night_study,
|
||||
'实际1号门控制时段': door1_time,
|
||||
'应该的1号门控制时段': expected_time
|
||||
})
|
||||
except json.JSONDecodeError:
|
||||
print(f"解析JSON失败: {result.get('msg')}")
|
||||
else:
|
||||
print(f"请求失败: {result}")
|
||||
except Exception as e:
|
||||
print(f"请求异常 {band_no}: {e}")
|
||||
|
||||
print("\n" + "="*80)
|
||||
print("检测结果:")
|
||||
print("="*80)
|
||||
|
||||
if incorrect_students:
|
||||
print(f"\n发现 {len(incorrect_students)} 个学生权限配置不正确:\n")
|
||||
for i, student in enumerate(incorrect_students, 1):
|
||||
print(f"{i}. 姓名: {student['姓名']}, 手环号: {student['手环号']}")
|
||||
print(f" 晚自习配置: {student['晚自习']} (2=上, 1=不上)")
|
||||
print(f" 实际1号门控制时段: {student['实际1号门控制时段']}")
|
||||
print(f" 应该的1号门控制时段: {student['应该的1号门控制时段']}")
|
||||
print()
|
||||
else:
|
||||
print("\n所有学生权限配置正确!")
|
||||
+4500
-2224
File diff suppressed because one or more lines are too long
@@ -0,0 +1,765 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from paho.mqtt import client as mqtt\n",
|
||||
"import json\n",
|
||||
"import time\n",
|
||||
"from requests import get,post,delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"broker = '100.64.0.6'\n",
|
||||
"# broker = '192.168.0.111'\n",
|
||||
"ip = \"http://100.64.0.6:9008\"\n",
|
||||
"port = 1883\n",
|
||||
"topic = \"/python/mqtt\"\n",
|
||||
"client_id = f'python-mqtt-demo'"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"0"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# MQTT客户端的回调函数\n",
|
||||
"def on_connect(client, userdata, flags, rc):\n",
|
||||
" print(\"Connected with result code \"+str(rc))\n",
|
||||
" # 连接成功后订阅主题\n",
|
||||
" # client.subscribe(\"#\")\n",
|
||||
"\n",
|
||||
"def on_message(client, userdata, msg):\n",
|
||||
" print(msg.topic+\" \"+str(msg.payload))\n",
|
||||
"\n",
|
||||
"# 创建MQTT客户端实例\n",
|
||||
"client = mqtt.Client(client_id=client_id)\n",
|
||||
"\n",
|
||||
"# 绑定回调函数\n",
|
||||
"client.on_connect = on_connect\n",
|
||||
"client.on_message = on_message\n",
|
||||
"\n",
|
||||
"# 连接到MQTT代理\n",
|
||||
"client.connect(broker, port, 60)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x201f147c7c0>"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"client.publish(\"demo/python\", \"Hello World!\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"token = post(f\"{ip}/login\",json={\"username\":\"admin\",\"password\":\"admin123\"}).json()[\"token\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"headers = {\"Authorization\":f\"Bearer {token}\"}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"records = get(f\"{ip}/school/devices/listPage?temaId=19&groupId=0&pageNum=1&pageSize=40\",headers=headers).json()[\"data\"][\"records\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"macs =[]\n",
|
||||
"for item in records:\n",
|
||||
" macs.append(item.get(\"machineCode\", \"\"))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"#在线\n",
|
||||
"onlines = []\n",
|
||||
"offlines=[]\n",
|
||||
"for item in records:\n",
|
||||
" if item.get(\"online\",0)==1:\n",
|
||||
" onlines.append(item['machineCode'])\n",
|
||||
" else:\n",
|
||||
" offlines.append(item['machineCode'])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"2"
|
||||
]
|
||||
},
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"len(onlines)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"2"
|
||||
]
|
||||
},
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"len(offlines)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[{'machineCode': '20254c7802bd',\n",
|
||||
" 'displayName': '七步洗手法',\n",
|
||||
" 'ip': '192.168.8.10',\n",
|
||||
" 'groupId': 1,\n",
|
||||
" 'contentId': 86,\n",
|
||||
" 'updateTime': '2025-10-28T09:15:36',\n",
|
||||
" 'version': '1.0.50',\n",
|
||||
" 'deviceName': '食堂门口',\n",
|
||||
" 'groupName': '食堂',\n",
|
||||
" 'createTime': '2025-10-26T08:58:36',\n",
|
||||
" 'teamId': 19,\n",
|
||||
" 'online': 0,\n",
|
||||
" 'location': '食堂门口',\n",
|
||||
" 'id': 'cade19b0-1f2d-4c9c-8289-c7741d56bb0b'},\n",
|
||||
" {'machineCode': '20254c9856bf',\n",
|
||||
" 'displayName': '七步洗手法',\n",
|
||||
" 'ip': '192.168.8.3',\n",
|
||||
" 'groupId': 30,\n",
|
||||
" 'contentId': 86,\n",
|
||||
" 'updateTime': '2025-10-28T10:34:34',\n",
|
||||
" 'version': '1.0.50',\n",
|
||||
" 'deviceName': '3楼一体机',\n",
|
||||
" 'groupName': '教学楼',\n",
|
||||
" 'createTime': '2025-10-12T17:58:33',\n",
|
||||
" 'teamId': 19,\n",
|
||||
" 'online': 1,\n",
|
||||
" 'location': '3楼',\n",
|
||||
" 'id': '9b876939-9258-4c87-a2f9-d4a61459e8ab'},\n",
|
||||
" {'machineCode': '20254c823347',\n",
|
||||
" 'displayName': '七步洗手法',\n",
|
||||
" 'ip': '192.168.8.2',\n",
|
||||
" 'groupId': 30,\n",
|
||||
" 'contentId': 86,\n",
|
||||
" 'updateTime': '2025-10-28T10:22:24',\n",
|
||||
" 'version': '1.0.50',\n",
|
||||
" 'deviceName': '2楼一体机',\n",
|
||||
" 'groupName': '教学楼',\n",
|
||||
" 'createTime': '2025-10-12T17:51:30',\n",
|
||||
" 'teamId': 19,\n",
|
||||
" 'online': 0,\n",
|
||||
" 'location': '2楼',\n",
|
||||
" 'id': '1c25761c-5917-4c2b-af42-f3cc258e6957'}]"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"records"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 升级"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x1b5acdeda90>"
|
||||
]
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"topic = \"common/publicizeTelevision/00e066fd87b1/ota/upgrade\"\n",
|
||||
"client.publish(topic,\"1\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for item in macs:\n",
|
||||
" topic = f\"common/publicizeTelevision/{item}/ota/upgrade\"\n",
|
||||
" client.publish(topic,\"1\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 看门狗"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"0 00e066fd898e\n",
|
||||
"1 000000000001\n",
|
||||
"2 00e0b413c78b\n",
|
||||
"3 00e066fd86c5\n",
|
||||
"4 000000000000\n",
|
||||
"5 00e066fd8711\n",
|
||||
"6 00e066fd8782\n",
|
||||
"7 00e066fd87b1\n",
|
||||
"8 00e066fd898d\n",
|
||||
"9 00e066fd8710\n",
|
||||
"10 00e066fd87ad\n",
|
||||
"11 00e066fd890b\n",
|
||||
"12 00e066fd882d\n",
|
||||
"13 00e066fd61fc\n",
|
||||
"14 00e066fd8927\n",
|
||||
"15 00e066fd898c\n",
|
||||
"16 00e066fd890c\n",
|
||||
"17 00e066fd86c4\n",
|
||||
"18 00e066fd8981\n",
|
||||
"19 00e066fd87af\n",
|
||||
"20 00e066fd891f\n",
|
||||
"21 000ec6431230\n",
|
||||
"22 00e066fd8988\n",
|
||||
"23 00e066fd8832\n",
|
||||
"24 00e066fd870d\n",
|
||||
"25 00e066fd8990\n",
|
||||
"26 00e066fd883a\n",
|
||||
"27 00e066fd882f\n",
|
||||
"28 00e066fd87b4\n",
|
||||
"29 00e066fd8989\n",
|
||||
"30 00e066fd8986\n",
|
||||
"31 00e066fd8797\n",
|
||||
"32 00e066fd898b\n",
|
||||
"33 00e066fd8931\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"for item,index in enumerate(macs):\n",
|
||||
" print(item,index)\n",
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# netsh interface ipv4 set address name=\"以太网\" source=static address=192.168.0.110 mask=255.255.255.0 gateway=192.168.0.1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'00E066FD8782'"
|
||||
]
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"'00e066fd8782'.upper()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 45,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for index,item in enumerate(macs):\n",
|
||||
" time.sleep(1)\n",
|
||||
" topic = f\"cmd/publicizeTelevision/{item}/dog\"\n",
|
||||
" message = {\"name\":\"watchDog.exe\",\"url\":\"http://schoolserver.com:9008/common/download/app/watchDog.exe\",\"type\":\"down\"}\n",
|
||||
" client.publish(topic,json.dumps(message,ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x2015292bfb0>"
|
||||
]
|
||||
},
|
||||
"execution_count": 30,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"topic = f\"cmd/publicizeTelevision/000c290a0fcb/dog\"\n",
|
||||
"message = {\"name\":\"watchDog.exe\",\"url\":\"http://schoolserver.com:9008/common/download/app/watchDog.exe\",\"type\":\"down\"}\n",
|
||||
"client.publish(topic,json.dumps(message,ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 77,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<>:3: SyntaxWarning: invalid escape sequence '\\S'\n",
|
||||
"<>:3: SyntaxWarning: invalid escape sequence '\\S'\n",
|
||||
"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_8436\\3533498662.py:3: SyntaxWarning: invalid escape sequence '\\S'\n",
|
||||
" message = '''reg query \"HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\"'''\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/publicizeTelevision/{item}/cmd\"\n",
|
||||
" message = '''reg query \"HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\"'''\n",
|
||||
"\n",
|
||||
" client.publish(topic,message)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/publicizeTelevision/{item}/cmd\"\n",
|
||||
" message = '''systeminfo'''\n",
|
||||
" client.publish(topic,message)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# cmd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/televisionDog/{item.upper()}/ask\"\n",
|
||||
" client.publish(topic,\"1\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'00E066FD8832'"
|
||||
]
|
||||
},
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"'00e066fd8832'.upper()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x20d4b920e00>"
|
||||
]
|
||||
},
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"topic = f\"cmd/televisionDog/00E066FD8832/ask\"\n",
|
||||
"client.publish(topic,\"1\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x21087171c60>"
|
||||
]
|
||||
},
|
||||
"execution_count": 24,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# netsh interface ipv4 set address name=\"以太网\" source=static address=13.1.1.125 mask=255.255.255.0 gateway=13.1.1.1\n",
|
||||
"# message = {\n",
|
||||
"# \"common\":['netsh interface ipv4 set address name=\"以太网\" source=static address=13.1.1.119 mask=255.255.255.0 gateway=13.1.1.1','ping 13.1.1.1','shutdown /r /t 00']\n",
|
||||
"# }\n",
|
||||
"message = {\n",
|
||||
" \"common\":['netsh interface ipv4 set address name=\"以太网\" source=static address=13.1.1.115 mask=255.255.255.0 gateway=13.1.1.1 & ping 13.1.1.1 & shutdown /r /t 00']\n",
|
||||
"}\n",
|
||||
"client.publish(\"cmd/televisionDog/00E066FD882D/common\",json.dumps(message, ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/televisionDog/{item.upper()}/common\"\n",
|
||||
" message = {\n",
|
||||
" \"common\":['''slmgr /skms 10.19.64.158 & slmgr /ato''']\n",
|
||||
"}\n",
|
||||
" client.publish(topic,json.dumps(message, ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 85,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<>:4: SyntaxWarning: invalid escape sequence '\\S'\n",
|
||||
"<>:4: SyntaxWarning: invalid escape sequence '\\S'\n",
|
||||
"C:\\Users\\Administrator\\AppData\\Local\\Temp\\ipykernel_8436\\2368358595.py:4: SyntaxWarning: invalid escape sequence '\\S'\n",
|
||||
" \"common\":['''reg query \"HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\"''']\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/televisionDog/{item.upper()}/common\"\n",
|
||||
" message = {\n",
|
||||
" \"common\":['''reg query \"HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run\"''']\n",
|
||||
"}\n",
|
||||
" client.publish(topic,json.dumps(message, ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 90,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"\n",
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/televisionDog/{item.upper()}/common\"\n",
|
||||
" message = {\n",
|
||||
" \"common\":[\"tasklist | findstr \\\"校宣机程序\\\"\"]\n",
|
||||
"}\n",
|
||||
" client.publish(topic,json.dumps(message, ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"<paho.mqtt.client.MQTTMessageInfo at 0x201c062b510>"
|
||||
]
|
||||
},
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"message = {\n",
|
||||
" \"common\":[\"ping 13.1.1.124\"]\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"client.publish(\"cmd/televisionDog/00E066FD898E/common\",json.dumps(message, ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"macs =['00e066fd883a']"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data = {\"macs\":[\"00e0b413c78b\",\"00e066fd86c5\",\"00e066fd8711\",\"00e066fd8782\",\"00e066fd87b1\",\"00e066fd898d\",\"00e066fd8710\",\"00e066fd87ad\",\"00e066fd890b\",\"00e066fd882d\",\"00e066fd61fc\",\"00e066fd8927\",\"00e066fd898c\",\"00e066fd890c\",\"00e066fd86c4\",\"00e066fd8981\",\"00e066fd87af\",\"00e066fd891f\",\"000ec6431230\",\"00e066fd8988\",\"00e066fd8832\",\"00e066fd870d\",\"00e066fd8990\",\"00e066fd883a\",\"00e066fd882f\",\"00e066fd87b4\",\"00e066fd8989\",\"00e066fd8986\",\"00e066fd8797\",\"00e066fd898b\",\"00e066fd8931\"],\"ips\":[\"13.1.1.120\",\"13.1.1.119\",\"13.1.1.125\",\"13.1.1.124\",\"13.1.1.126\",\"13.1.1.131\",\"13.1.1.127\",\"13.1.1.129\",\"13.1.1.117\",\"13.1.1.180\",\"13.1.1.114\",\"13.1.1.116\",\"13.1.1.118\",\"13.1.1.104\",\"13.1.1.113\",\"13.1.1.139\",\"13.1.1.136\",\"13.1.1.111\",\"13.1.1.102\",\"13.1.1.108\",\"13.1.1.110\",\"13.1.1.132\",\"13.1.1.130\",\"13.1.1.122\",\"13.1.1.123\",\"13.1.1.112\",\"13.1.1.107\",\"13.1.1.109\",\"13.1.1.115\",\"13.1.1.105\",\"13.1.1.135\"]}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"tem = []\n",
|
||||
"for index,item in enumerate(data[\"macs\"]):\n",
|
||||
" tem.append({\"mac\":item,\"ip\":data[\"ips\"][index]})"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[{'mac': '00e0b413c78b', 'ip': '13.1.1.120'},\n",
|
||||
" {'mac': '00e066fd86c5', 'ip': '13.1.1.119'},\n",
|
||||
" {'mac': '00e066fd8711', 'ip': '13.1.1.125'},\n",
|
||||
" {'mac': '00e066fd8782', 'ip': '13.1.1.124'},\n",
|
||||
" {'mac': '00e066fd87b1', 'ip': '13.1.1.126'},\n",
|
||||
" {'mac': '00e066fd898d', 'ip': '13.1.1.131'},\n",
|
||||
" {'mac': '00e066fd8710', 'ip': '13.1.1.127'},\n",
|
||||
" {'mac': '00e066fd87ad', 'ip': '13.1.1.129'},\n",
|
||||
" {'mac': '00e066fd890b', 'ip': '13.1.1.117'},\n",
|
||||
" {'mac': '00e066fd882d', 'ip': '13.1.1.180'},\n",
|
||||
" {'mac': '00e066fd61fc', 'ip': '13.1.1.114'},\n",
|
||||
" {'mac': '00e066fd8927', 'ip': '13.1.1.116'},\n",
|
||||
" {'mac': '00e066fd898c', 'ip': '13.1.1.118'},\n",
|
||||
" {'mac': '00e066fd890c', 'ip': '13.1.1.104'},\n",
|
||||
" {'mac': '00e066fd86c4', 'ip': '13.1.1.113'},\n",
|
||||
" {'mac': '00e066fd8981', 'ip': '13.1.1.139'},\n",
|
||||
" {'mac': '00e066fd87af', 'ip': '13.1.1.136'},\n",
|
||||
" {'mac': '00e066fd891f', 'ip': '13.1.1.111'},\n",
|
||||
" {'mac': '000ec6431230', 'ip': '13.1.1.102'},\n",
|
||||
" {'mac': '00e066fd8988', 'ip': '13.1.1.108'},\n",
|
||||
" {'mac': '00e066fd8832', 'ip': '13.1.1.110'},\n",
|
||||
" {'mac': '00e066fd870d', 'ip': '13.1.1.132'},\n",
|
||||
" {'mac': '00e066fd8990', 'ip': '13.1.1.130'},\n",
|
||||
" {'mac': '00e066fd883a', 'ip': '13.1.1.122'},\n",
|
||||
" {'mac': '00e066fd882f', 'ip': '13.1.1.123'},\n",
|
||||
" {'mac': '00e066fd87b4', 'ip': '13.1.1.112'},\n",
|
||||
" {'mac': '00e066fd8989', 'ip': '13.1.1.107'},\n",
|
||||
" {'mac': '00e066fd8986', 'ip': '13.1.1.109'},\n",
|
||||
" {'mac': '00e066fd8797', 'ip': '13.1.1.115'},\n",
|
||||
" {'mac': '00e066fd898b', 'ip': '13.1.1.105'},\n",
|
||||
" {'mac': '00e066fd8931', 'ip': '13.1.1.135'}]"
|
||||
]
|
||||
},
|
||||
"execution_count": 19,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"tem"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#调整轮播间隔"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for item in macs:\n",
|
||||
" topic = f\"cmd/publicizeTelevision/{item}/setting\"\n",
|
||||
" message = {\n",
|
||||
" \"data\":60000\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" client.publish(topic,json.dumps(message, ensure_ascii=False))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"['00e0220fa0e4', '20254c7802bd', '20254c9856bf', '20254c823347']"
|
||||
]
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"macs"
|
||||
]
|
||||
}
|
||||
],
|
||||
"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
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "0b9fa088",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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": 5
|
||||
}
|
||||
|
||||
+2948
-1364
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,469 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "853a3284",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from requests import get,post\n",
|
||||
"import time\n",
|
||||
"import json\n",
|
||||
"ip = \"http://band.hxzhxy.cn\"\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",
|
||||
"}\n",
|
||||
"# http://139.159.182.121:8092/card/findUser?bandNo=0269414644&controllerSN=233159158\n",
|
||||
"data = get(f\"https://band.hxzhxy.cn/card/listStuWithRule?gradeId=&classId=&screen=0¶m=&board=2&type=1¤tPage=1&pageNumber=0&pageSize=1000&pageTotal=593&teamId=110\",headers=header).json()\n",
|
||||
"stus2 = data[\"data\"][\"listData\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "4bbd5102",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data = get(f\"https://band.hxzhxy.cn/card/listStuWithRule?gradeId=&classId=&screen=0¶m=&board=2&type=1¤tPage=1&pageNumber=0&pageSize=1000&pageTotal=593&teamId=110\",headers=header).json()\n",
|
||||
"stus2 = data[\"data\"][\"listData\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "24f76d62",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "7fe5e94c",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'stus' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[4], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m stus[\u001b[38;5;241m0\u001b[39m]\n",
|
||||
"\u001b[1;31mNameError\u001b[0m: name 'stus' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"stus[0]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"id": "93cec8e3",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sns = [\n",
|
||||
" {\n",
|
||||
" \"id\": 12,\n",
|
||||
" \"serialNo\": \"233159161\",\n",
|
||||
" \"teamId\": 110,\n",
|
||||
" \"readHeadCount\": 2,\n",
|
||||
" \"name\": \"1号通道\",\n",
|
||||
" \"ip\": \"10.68.66.55\",\n",
|
||||
" \"remark\": \"\",\n",
|
||||
" \"online\": 1,\n",
|
||||
" \"onlineTime\": \"2025-11-17 18:54:13\",\n",
|
||||
" \"existingRules\": [\n",
|
||||
" {\n",
|
||||
" \"name\": \"全勤\",\n",
|
||||
" \"id\": 68,\n",
|
||||
" \"typeId\": 155\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"name\": \"学生临时规则-上晚自习\",\n",
|
||||
" \"id\": 69,\n",
|
||||
" \"typeId\": 156\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"name\": \"不上晚自习\",\n",
|
||||
" \"id\": 70,\n",
|
||||
" \"typeId\": 157\n",
|
||||
" }\n",
|
||||
" ]\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"id\": 16,\n",
|
||||
" \"serialNo\": \"233159158\",\n",
|
||||
" \"teamId\": 110,\n",
|
||||
" \"readHeadCount\": 2,\n",
|
||||
" \"name\": \"2号道闸\",\n",
|
||||
" \"ip\": \"10.68.66.56\",\n",
|
||||
" \"remark\": \"\",\n",
|
||||
" \"online\": 1,\n",
|
||||
" \"onlineTime\": \"2025-11-17 18:54:14\",\n",
|
||||
" \"existingRules\": [\n",
|
||||
" {\n",
|
||||
" \"name\": \"全勤\",\n",
|
||||
" \"id\": 68,\n",
|
||||
" \"typeId\": 124\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"name\": \"学生临时规则-上晚自习\",\n",
|
||||
" \"id\": 69,\n",
|
||||
" \"typeId\": 125\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"name\": \"不上晚自习\",\n",
|
||||
" \"id\": 70,\n",
|
||||
" \"typeId\": 126\n",
|
||||
" }\n",
|
||||
" ]\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"id\": 17,\n",
|
||||
" \"serialNo\": \"233159159\",\n",
|
||||
" \"teamId\": 110,\n",
|
||||
" \"readHeadCount\": 2,\n",
|
||||
" \"name\": \"3号道闸\",\n",
|
||||
" \"ip\": \"10.68.66.57\",\n",
|
||||
" \"remark\": \"\",\n",
|
||||
" \"online\": 1,\n",
|
||||
" \"onlineTime\": \"2025-11-17 18:54:13\",\n",
|
||||
" \"existingRules\": [\n",
|
||||
" {\n",
|
||||
" \"name\": \"学生临时规则-上晚自习\",\n",
|
||||
" \"id\": 69,\n",
|
||||
" \"typeId\": 172\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"name\": \"全勤\",\n",
|
||||
" \"id\": 68,\n",
|
||||
" \"typeId\": 180\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"name\": \"不上晚自习\",\n",
|
||||
" \"id\": 70,\n",
|
||||
" \"typeId\": 183\n",
|
||||
" }\n",
|
||||
" ]\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"id\": 18,\n",
|
||||
" \"serialNo\": \"233159157\",\n",
|
||||
" \"teamId\": 110,\n",
|
||||
" \"readHeadCount\": 2,\n",
|
||||
" \"name\": \"4号道闸\",\n",
|
||||
" \"ip\": \"10.68.66.58\",\n",
|
||||
" \"remark\": \"\",\n",
|
||||
" \"online\": 1,\n",
|
||||
" \"onlineTime\": \"2025-11-17 18:54:13\",\n",
|
||||
" \"existingRules\": [\n",
|
||||
" {\n",
|
||||
" \"name\": \"全勤\",\n",
|
||||
" \"id\": 68,\n",
|
||||
" \"typeId\": 188\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"name\": \"学生临时规则-上晚自习\",\n",
|
||||
" \"id\": 69,\n",
|
||||
" \"typeId\": 189\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"name\": \"不上晚自习\",\n",
|
||||
" \"id\": 70,\n",
|
||||
" \"typeId\": 190\n",
|
||||
" }\n",
|
||||
" ]\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"id\": 19,\n",
|
||||
" \"serialNo\": \"233159164\",\n",
|
||||
" \"teamId\": 110,\n",
|
||||
" \"readHeadCount\": 2,\n",
|
||||
" \"name\": \"广告门\",\n",
|
||||
" \"ip\": \"10.68.66.59\",\n",
|
||||
" \"remark\": \"\",\n",
|
||||
" \"online\": 1,\n",
|
||||
" \"onlineTime\": \"2025-11-17 18:54:13\",\n",
|
||||
" \"existingRules\": [\n",
|
||||
" {\n",
|
||||
" \"name\": \"全勤\",\n",
|
||||
" \"id\": 68,\n",
|
||||
" \"typeId\": 191\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"name\": \"学生临时规则-上晚自习\",\n",
|
||||
" \"id\": 69,\n",
|
||||
" \"typeId\": 192\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"name\": \"不上晚自习\",\n",
|
||||
" \"id\": 70,\n",
|
||||
" \"typeId\": 193\n",
|
||||
" }\n",
|
||||
" ]\n",
|
||||
" }\n",
|
||||
" ]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"id": "3a35ac84",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1号通道 熊浩宇 无权限\n",
|
||||
"1号通道 郭思垚 无权限\n",
|
||||
"1号通道 雷林皓 无权限\n",
|
||||
"1号通道 汪梓衡 无权限\n",
|
||||
"1号通道 徐沐瑶 无权限\n",
|
||||
"1号通道 方苇骐 无权限\n",
|
||||
"2号道闸 熊浩宇 无权限\n",
|
||||
"2号道闸 郭思垚 无权限\n",
|
||||
"2号道闸 雷林皓 无权限\n",
|
||||
"2号道闸 汪梓衡 无权限\n",
|
||||
"2号道闸 方苇骐 无权限\n",
|
||||
"3号道闸 熊浩宇 无权限\n",
|
||||
"3号道闸 郭思垚 无权限\n",
|
||||
"3号道闸 雷林皓 无权限\n",
|
||||
"3号道闸 汪梓衡 无权限\n",
|
||||
"3号道闸 徐沐瑶 无权限\n",
|
||||
"3号道闸 方苇骐 无权限\n",
|
||||
"4号道闸 熊浩宇 无权限\n",
|
||||
"4号道闸 郭思垚 无权限\n",
|
||||
"4号道闸 雷林皓 无权限\n",
|
||||
"4号道闸 汪梓衡 无权限\n",
|
||||
"4号道闸 徐沐瑶 无权限\n",
|
||||
"4号道闸 方苇骐 无权限\n",
|
||||
"广告门 熊浩宇 无权限\n",
|
||||
"广告门 郭思垚 无权限\n",
|
||||
"广告门 雷林皓 无权限\n",
|
||||
"广告门 汪梓衡 无权限\n",
|
||||
"广告门 徐沐瑶 无权限\n",
|
||||
"广告门 方苇骐 无权限\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"for sn in sns:\n",
|
||||
" for stu in stus:\n",
|
||||
" res = get( f\"http://139.159.182.121:8092/card/findUser?bandNo={stu['手环号']}&controllerSN={sn['serialNo']}\").json()\n",
|
||||
" if res['success']:\n",
|
||||
" result = json.loads(res['msg'])\n",
|
||||
" flag = result['result']['success']\n",
|
||||
" if flag:\n",
|
||||
" pass\n",
|
||||
" # print(f\"{stu['姓名']} 有权限\")\n",
|
||||
" else:\n",
|
||||
" print(f\"{sn['name']} {stu['姓名']} 无权限\")\n",
|
||||
" "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 31,
|
||||
"id": "c7349202",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import time"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 32,
|
||||
"id": "e7166b72",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "",
|
||||
"evalue": "",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m在当前单元格或上一个单元格中执行代码时 Kernel 崩溃。\n",
|
||||
"\u001b[1;31m请查看单元格中的代码,以确定故障的可能原因。\n",
|
||||
"\u001b[1;31m单击<a href='https://aka.ms/vscodeJupyterKernelCrash'>此处</a>了解详细信息。\n",
|
||||
"\u001b[1;31m有关更多详细信息,请查看 Jupyter <a href='command:jupyter.viewOutput'>log</a>。"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"while True:\n",
|
||||
" data = get(\"https://www.hxzhxy.cn/hxyd-api/gate/card/list2?teamId=110&name=&screen=3&startDate=1763378175113&state=&endDate=1763378175113&type=0&gateNo=&pageSize=30&pageNumber=0&teaType=0&doorInfo=&access_token=e8ae9533-ebbe-4d14-8251-6a587ca40ac2\").json()\n",
|
||||
" \n",
|
||||
" for stu in data[\"data\"][\"content\"]:\n",
|
||||
" if stu[\"eventName\"] !='正常刷卡开门':\n",
|
||||
" print(stu['name'])\n",
|
||||
" time.sleep(3)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"id": "700384c1",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"251"
|
||||
]
|
||||
},
|
||||
"execution_count": 21,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"len(list(stus))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"id": "95aa8903",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"289"
|
||||
]
|
||||
},
|
||||
"execution_count": 22,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"251+38"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"id": "b7febbf5",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"李翰玟 上晚自习\n",
|
||||
"许睿 上晚自习\n",
|
||||
"吕文轩 上晚自习\n",
|
||||
"杨宇晨 上晚自习\n",
|
||||
"赖馨玥 上晚自习\n",
|
||||
"张成 上晚自习\n",
|
||||
"佘锦宸 上晚自习\n",
|
||||
"钟雅祺 上晚自习\n",
|
||||
"罗凯玟 上晚自习\n",
|
||||
"张翼然 上晚自习\n",
|
||||
"贾玥彤 上晚自习\n",
|
||||
"李晞彤 上晚自习\n",
|
||||
"徐欣渝 上晚自习\n",
|
||||
"王为 上晚自习\n",
|
||||
"赖桔兴 上晚自习\n",
|
||||
"龚跃鑫 上晚自习\n",
|
||||
"郑好 上晚自习\n",
|
||||
"苟恩瑞 上晚自习\n",
|
||||
"顾子昂 上晚自习\n",
|
||||
"符曾洋 上晚自习\n",
|
||||
"吴嘉唐 上晚自习\n",
|
||||
"张思雅 上晚自习\n",
|
||||
"管子漩 上晚自习\n",
|
||||
"张文杰 上晚自习\n",
|
||||
"陈熙辰 上晚自习\n",
|
||||
"代芸萱 上晚自习\n",
|
||||
"刘星彤 上晚自习\n",
|
||||
"肖茜茜 上晚自习\n",
|
||||
"白益轩 上晚自习\n",
|
||||
"冯靖 上晚自习\n",
|
||||
"陈诗雨 上晚自习\n",
|
||||
"周渤灵 上晚自习\n",
|
||||
"李文斌 上晚自习\n",
|
||||
"王震宇 上晚自习\n",
|
||||
"王正豪 上晚自习\n",
|
||||
"李漪诺 上晚自习\n",
|
||||
"吴金龙 上晚自习\n",
|
||||
"马鸿森 上晚自习\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"for item in stus2:\n",
|
||||
" if item[\"姓名\"] in stus:\n",
|
||||
" if item['晚自习']==2 :\n",
|
||||
" tag='上晚自习'\n",
|
||||
" else:\n",
|
||||
" tag='不上晚自习'\n",
|
||||
" print(f'{item[\"姓名\"]} {tag}' )"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 28,
|
||||
"id": "f34f6606",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n",
|
||||
"{\"success\":true,\"msg\":\"操作成功\",\"code\":0,\"data\":null}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"for sn in sns:\n",
|
||||
" print(get(f\"http://139.159.182.121:8092/card/getTime\",params={\"controllerSN\":int(sn['serialNo'])}).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": 5
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user