Files
python----/北川/学生对应的通道号.ipynb
T
admin aac9f5934d feat: 添加多个功能模块和工具脚本
- 新增websocket客户端和服务端实现
- 添加图片压缩工具和快速压缩脚本
- 实现学生信息处理相关API
- 添加MQTT客户端和消息处理功能
- 更新.gitignore忽略更多文件类型
- 添加数据库操作工具和示例
- 实现多个测试脚本和工具类
2026-04-13 14:47:50 +08:00

66 KiB

In [1]:
from requests import get,post,put
import pandas as pd
import time
teamId = 106
# ip = "http://192.168.0.244:8101"
ip = "http://10.143.25.3:8090"
param = {
    "username": "tangchao",
    "password": "123456a",
    "client_id": "client",
    "grant_type": "password",
    "client_secret": "123456",
}
data = get(url=f"{ip}/oauth/token",params=param).json()
token = data["access_token"]
header = {
    "content-type": "application/json",
    "authorization": f"Bearer {token}",
}
In [2]:
camera_data = get(f"{ip}/camera/pageList?teamId=106&page=1&pageSize=50&pageNumber=1&sortField=id&sortOrder=desc",headers=header).json()["data"]["records"]
In [3]:
camera_data
Out [3]:
[{'id': 291,
  'no': '2202',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.7',
  'port': '80',
  'name': '2-202',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '1',
  'liveurl': None,
  'channelNo': None,
  'roomId': 267,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 0,
  'onlineTime': 1766548320000,
  'classRoom': '2-202'},
 {'id': 292,
  'no': '2203',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.10',
  'port': '80',
  'name': '2-203',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '2',
  'liveurl': None,
  'channelNo': None,
  'roomId': 268,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-203'},
 {'id': 293,
  'no': '2204',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.13',
  'port': '80',
  'name': '2-204',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '3',
  'liveurl': None,
  'channelNo': None,
  'roomId': 269,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-204'},
 {'id': 294,
  'no': '2205',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.16',
  'port': '80',
  'name': '2-205',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '4',
  'liveurl': None,
  'channelNo': None,
  'roomId': 270,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-205'},
 {'id': 295,
  'no': '2206',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.19',
  'port': '80',
  'name': '2-206',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '5',
  'liveurl': None,
  'channelNo': None,
  'roomId': 271,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 0,
  'onlineTime': 1765520810000,
  'classRoom': '2-206'},
 {'id': 296,
  'no': '2207',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.22',
  'port': '80',
  'name': '2-207',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '6',
  'liveurl': None,
  'channelNo': None,
  'roomId': 272,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-207'},
 {'id': 297,
  'no': '2208',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.25',
  'port': '80',
  'name': '2-208',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '7',
  'liveurl': None,
  'channelNo': None,
  'roomId': 273,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-208'},
 {'id': 298,
  'no': '2209',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.28',
  'port': '80',
  'name': '2-209',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '8',
  'liveurl': None,
  'channelNo': None,
  'roomId': 274,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 0,
  'onlineTime': 1765888140000,
  'classRoom': '2-209'},
 {'id': 299,
  'no': '2302',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.31',
  'port': '80',
  'name': '2-302',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '9',
  'liveurl': None,
  'channelNo': None,
  'roomId': 293,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-302'},
 {'id': 300,
  'no': '2303',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.34',
  'port': '80',
  'name': '2-303',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '10',
  'liveurl': None,
  'channelNo': None,
  'roomId': 294,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-303'},
 {'id': 301,
  'no': '2304',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.37',
  'port': '80',
  'name': '2-304',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '11',
  'liveurl': None,
  'channelNo': None,
  'roomId': 295,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-304'},
 {'id': 302,
  'no': '2305',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.40',
  'port': '80',
  'name': '2-305',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '12',
  'liveurl': None,
  'channelNo': None,
  'roomId': 296,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-305'},
 {'id': 303,
  'no': '2306',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.43',
  'port': '80',
  'name': '2-306',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '13',
  'liveurl': None,
  'channelNo': None,
  'roomId': 297,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-306'},
 {'id': 304,
  'no': '2307',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.46',
  'port': '80',
  'name': '2-307',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '14',
  'liveurl': None,
  'channelNo': None,
  'roomId': 298,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-307'},
 {'id': 305,
  'no': '2308',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.49',
  'port': '80',
  'name': '2-308',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '15',
  'liveurl': None,
  'channelNo': None,
  'roomId': 299,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-308'},
 {'id': 306,
  'no': '2309',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.52',
  'port': '80',
  'name': '2-309',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '16',
  'liveurl': None,
  'channelNo': None,
  'roomId': 300,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-309'},
 {'id': 307,
  'no': '2301',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.79',
  'port': '80',
  'name': '2-301',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '17',
  'liveurl': None,
  'channelNo': None,
  'roomId': 292,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-301'},
 {'id': 308,
  'no': '2402',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.55',
  'port': '80',
  'name': '2-402',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '18',
  'liveurl': None,
  'channelNo': None,
  'roomId': 284,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-402'},
 {'id': 309,
  'no': '2403',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.58',
  'port': '80',
  'name': '2-403',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '19',
  'liveurl': None,
  'channelNo': None,
  'roomId': 285,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-403'},
 {'id': 310,
  'no': '2404',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.61',
  'port': '80',
  'name': '2-404',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '20',
  'liveurl': None,
  'channelNo': None,
  'roomId': 286,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-404'},
 {'id': 311,
  'no': '2405',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.64',
  'port': '80',
  'name': '2-405',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '21',
  'liveurl': None,
  'channelNo': None,
  'roomId': 287,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-405'},
 {'id': 312,
  'no': '2406',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.67',
  'port': '80',
  'name': '2-406',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '22',
  'liveurl': None,
  'channelNo': None,
  'roomId': 288,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-406'},
 {'id': 313,
  'no': '2407',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.70',
  'port': '80',
  'name': '2-407',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '23',
  'liveurl': None,
  'channelNo': None,
  'roomId': 289,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-407'},
 {'id': 314,
  'no': '2408',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.73',
  'port': '80',
  'name': '2-408',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '24',
  'liveurl': None,
  'channelNo': None,
  'roomId': 290,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-408'},
 {'id': 315,
  'no': '2409',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.76',
  'port': '80',
  'name': '2-409',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '25',
  'liveurl': None,
  'channelNo': None,
  'roomId': 291,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '2-409'},
 {'id': 316,
  'no': '1202',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.82',
  'port': '80',
  'name': '1-202',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '26',
  'liveurl': None,
  'channelNo': None,
  'roomId': 245,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-202'},
 {'id': 317,
  'no': '1203',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.85',
  'port': '80',
  'name': '1-203',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '27',
  'liveurl': None,
  'channelNo': None,
  'roomId': 246,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-203'},
 {'id': 318,
  'no': '1204',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.88',
  'port': '80',
  'name': '1-204',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '28',
  'liveurl': None,
  'channelNo': None,
  'roomId': 247,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-204'},
 {'id': 319,
  'no': '1205',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.91',
  'port': '80',
  'name': '1-205',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '29',
  'liveurl': None,
  'channelNo': None,
  'roomId': 248,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-205'},
 {'id': 320,
  'no': '1206',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.94',
  'port': '80',
  'name': '1-206',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '30',
  'liveurl': None,
  'channelNo': None,
  'roomId': 249,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-206'},
 {'id': 321,
  'no': '1207',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.97',
  'port': '80',
  'name': '1-207',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '31',
  'liveurl': None,
  'channelNo': None,
  'roomId': 250,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-207'},
 {'id': 322,
  'no': '1210',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.100',
  'port': '80',
  'name': '1-210',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '32',
  'liveurl': None,
  'channelNo': None,
  'roomId': 301,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-210'},
 {'id': 323,
  'no': '1302',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.106',
  'port': '80',
  'name': '1-302',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '33',
  'liveurl': None,
  'channelNo': None,
  'roomId': 252,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-302'},
 {'id': 324,
  'no': '1303',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.109',
  'port': '80',
  'name': '1-303',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '34',
  'liveurl': None,
  'channelNo': None,
  'roomId': 253,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-303'},
 {'id': 325,
  'no': '1304',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.112',
  'port': '80',
  'name': '1-304',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '35',
  'liveurl': None,
  'channelNo': None,
  'roomId': 254,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 0,
  'onlineTime': 1766480820000,
  'classRoom': '1-304'},
 {'id': 326,
  'no': '1305',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.115',
  'port': '80',
  'name': '1-305',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '36',
  'liveurl': None,
  'channelNo': None,
  'roomId': 255,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-305'},
 {'id': 327,
  'no': '1306',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.118',
  'port': '80',
  'name': '1-306',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '37',
  'liveurl': None,
  'channelNo': None,
  'roomId': 256,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-306'},
 {'id': 328,
  'no': '1307',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.121',
  'port': '80',
  'name': '1-307',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '38',
  'liveurl': None,
  'channelNo': None,
  'roomId': 257,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-307'},
 {'id': 329,
  'no': '1301',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.124',
  'port': '80',
  'name': '1-301',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '39',
  'liveurl': None,
  'channelNo': None,
  'roomId': 251,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-301'},
 {'id': 330,
  'no': '1310',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.127',
  'port': '80',
  'name': '1-310',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '40',
  'liveurl': None,
  'channelNo': None,
  'roomId': 258,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-310'},
 {'id': 331,
  'no': '1402',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.130',
  'port': '80',
  'name': '1-402',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '41',
  'liveurl': None,
  'channelNo': None,
  'roomId': 259,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-402'},
 {'id': 332,
  'no': '1403',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.133',
  'port': '80',
  'name': '1-403',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '42',
  'liveurl': None,
  'channelNo': None,
  'roomId': 261,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-403'},
 {'id': 333,
  'no': '1404',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.136',
  'port': '80',
  'name': '1-404',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '43',
  'liveurl': None,
  'channelNo': None,
  'roomId': 262,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-404'},
 {'id': 334,
  'no': '1405',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.139',
  'port': '80',
  'name': '1-405',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '44',
  'liveurl': None,
  'channelNo': None,
  'roomId': 263,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-405'},
 {'id': 335,
  'no': '1406',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.142',
  'port': '80',
  'name': '1-406',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '45',
  'liveurl': None,
  'channelNo': None,
  'roomId': 264,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-406'},
 {'id': 336,
  'no': '1407',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.145',
  'port': '80',
  'name': '1-407',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '46',
  'liveurl': None,
  'channelNo': None,
  'roomId': 265,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 0,
  'onlineTime': 1766572140000,
  'classRoom': '1-407'},
 {'id': 337,
  'no': '1410',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.148',
  'port': '80',
  'name': '1-410',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '47',
  'liveurl': None,
  'channelNo': None,
  'roomId': 266,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '1-410'},
 {'id': 338,
  'no': '9308',
  'type': None,
  'belongNvrId': None,
  'account': 'admin',
  'password': 'admin',
  'ip': '10.143.25.103',
  'port': '80',
  'name': '9-308',
  'ptzControl': 0,
  'enable': 0,
  'testerId': None,
  'position': None,
  'initialStateHeight': None,
  'initialStatePitchAngle': None,
  'app': None,
  'channel': '48',
  'liveurl': None,
  'channelNo': None,
  'roomId': 302,
  'teamId': 106,
  'createTime': 1755489156000,
  'updateTime': None,
  'pullUrl': None,
  'status': 1,
  'onlineTime': 1766573460000,
  'classRoom': '9-308'}]
In [4]:
students = get(f"http://10.143.25.3/prod-api/school/stuface/list?teamId=106&page=1&pageSize=1000&gradeId=&classId=&stuName=&stuNo=&pageNumber=0&sortField=create_time&sortOrder=asc&access_token=c256320a-7216-45ce-891c-751b73fe8d71").json()
In [6]:
nopic = []
for item in students['data']["records"]:
    if item["files"]==None or item["files"]==[]:
        nopic.append(item)
In [8]:
df2 = pd.DataFrame(nopic)
df2.to_excel("无照片学生.xlsx",index=False)
In [4]:
camera_channel = {i["classRoom"]:i["channel"] for i in camera_data}
In [5]:
camera_channel
Out [5]:
{'2-202': '1',
 '2-203': '2',
 '2-204': '3',
 '2-205': '4',
 '2-206': '5',
 '2-207': '6',
 '2-208': '7',
 '2-209': '8',
 '2-302': '9',
 '2-303': '10',
 '2-304': '11',
 '2-305': '12',
 '2-306': '13',
 '2-307': '14',
 '2-308': '15',
 '2-309': '16',
 '2-301': '17',
 '2-402': '18',
 '2-403': '19',
 '2-404': '20',
 '2-405': '21',
 '2-406': '22',
 '2-407': '23',
 '2-408': '24',
 '2-409': '25',
 '1-202': '26',
 '1-203': '27',
 '1-204': '28',
 '1-205': '29',
 '1-206': '30',
 '1-207': '31',
 '1-210': '32',
 '1-302': '33',
 '1-303': '34',
 '1-304': '35',
 '1-305': '36',
 '1-306': '37',
 '1-307': '38',
 '1-301': '39',
 '1-310': '40',
 '1-402': '41',
 '1-403': '42',
 '1-404': '43',
 '1-405': '44',
 '1-406': '45',
 '1-407': '46',
 '1-410': '47',
 '9-308': '48'}
In [ ]:
class2room = get(f"{ip}/classAndRoom/listPage?teamId=106&page=1&pageSize=100&pageNumber=1",headers=header).json()["data"]["records"]
tem = []
for i in class2room:
    if i["classAndRooms"]:
        tem.append(i["classAndRooms"][0])
In [16]:
tem
Out [16]:
[{'id': 53, 'classId': 693, 'roomId': 269, 'roomName': '2-204'},
 {'id': 12, 'classId': 694, 'roomId': 306, 'roomName': '5-303'},
 {'id': 13, 'classId': 695, 'roomId': 301, 'roomName': '1-210'},
 {'id': 14, 'classId': 696, 'roomId': 305, 'roomName': '5-304'},
 {'id': 15, 'classId': 697, 'roomId': 245, 'roomName': '1-202'},
 {'id': 17, 'classId': 700, 'roomId': 267, 'roomName': '2-202'},
 {'id': 16, 'classId': 701, 'roomId': 307, 'roomName': '5-307'},
 {'id': 18, 'classId': 702, 'roomId': 246, 'roomName': '1-203'},
 {'id': 50, 'classId': 709, 'roomId': 268, 'roomName': '2-203'},
 {'id': 26, 'classId': 711, 'roomId': 249, 'roomName': '1-206'},
 {'id': 20, 'classId': 714, 'roomId': 248, 'roomName': '1-205'},
 {'id': 21, 'classId': 715, 'roomId': 309, 'roomName': '1-309'},
 {'id': 22, 'classId': 717, 'roomId': 268, 'roomName': '2-203'},
 {'id': 24, 'classId': 720, 'roomId': 250, 'roomName': '1-207'},
 {'id': 54, 'classId': 721, 'roomId': 250, 'roomName': '1-207'},
 {'id': 25, 'classId': 722, 'roomId': 270, 'roomName': '2-205'},
 {'id': 55, 'classId': 723, 'roomId': 245, 'roomName': '1-202'},
 {'id': 52, 'classId': 727, 'roomId': 273, 'roomName': '2-208'},
 {'id': 27, 'classId': 735, 'roomId': 274, 'roomName': '2-209'},
 {'id': 28, 'classId': 737, 'roomId': 271, 'roomName': '2-206'},
 {'id': 29, 'classId': 742, 'roomId': 264, 'roomName': '1-406'},
 {'id': 30, 'classId': 744, 'roomId': 310, 'roomName': '1-209'},
 {'id': 31, 'classId': 752, 'roomId': 290, 'roomName': '2-408'},
 {'id': 32, 'classId': 753, 'roomId': 297, 'roomName': '2-306'},
 {'id': 33, 'classId': 754, 'roomId': 302, 'roomName': '9-308'},
 {'id': 34, 'classId': 755, 'roomId': 300, 'roomName': '2-309'},
 {'id': 35, 'classId': 756, 'roomId': 311, 'roomName': '2-401'},
 {'id': 47, 'classId': 759, 'roomId': 299, 'roomName': '2-308'},
 {'id': 37, 'classId': 760, 'roomId': 285, 'roomName': '2-403'},
 {'id': 51, 'classId': 761, 'roomId': 298, 'roomName': '2-307'},
 {'id': 38, 'classId': 763, 'roomId': 293, 'roomName': '2-302'},
 {'id': 39, 'classId': 764, 'roomId': 294, 'roomName': '2-303'},
 {'id': 40, 'classId': 765, 'roomId': 295, 'roomName': '2-304'},
 {'id': 41, 'classId': 766, 'roomId': 291, 'roomName': '2-409'},
 {'id': 43, 'classId': 768, 'roomId': 284, 'roomName': '2-402'},
 {'id': 49, 'classId': 769, 'roomId': 288, 'roomName': '2-406'},
 {'id': 46, 'classId': 770, 'roomId': 292, 'roomName': '2-301'},
 {'id': 45, 'classId': 771, 'roomId': 296, 'roomName': '2-305'},
 {'id': 42, 'classId': 773, 'roomId': 312, 'roomName': '涂装实训室对面'},
 {'id': 48, 'classId': 777, 'roomId': 284, 'roomName': '2-402'}]
In [17]:
data = []
for i in tem:
    key = i['roomName']
    value = camera_channel.get(key,False)
    if value:
        i["channel"] = camera_channel[key]
        data.append(i)
In [19]:
data
Out [19]:
[{'id': 53,
  'classId': 693,
  'roomId': 269,
  'roomName': '2-204',
  'channel': '3'},
 {'id': 13,
  'classId': 695,
  'roomId': 301,
  'roomName': '1-210',
  'channel': '32'},
 {'id': 15,
  'classId': 697,
  'roomId': 245,
  'roomName': '1-202',
  'channel': '26'},
 {'id': 17,
  'classId': 700,
  'roomId': 267,
  'roomName': '2-202',
  'channel': '1'},
 {'id': 18,
  'classId': 702,
  'roomId': 246,
  'roomName': '1-203',
  'channel': '27'},
 {'id': 50,
  'classId': 709,
  'roomId': 268,
  'roomName': '2-203',
  'channel': '2'},
 {'id': 26,
  'classId': 711,
  'roomId': 249,
  'roomName': '1-206',
  'channel': '30'},
 {'id': 20,
  'classId': 714,
  'roomId': 248,
  'roomName': '1-205',
  'channel': '29'},
 {'id': 22,
  'classId': 717,
  'roomId': 268,
  'roomName': '2-203',
  'channel': '2'},
 {'id': 24,
  'classId': 720,
  'roomId': 250,
  'roomName': '1-207',
  'channel': '31'},
 {'id': 54,
  'classId': 721,
  'roomId': 250,
  'roomName': '1-207',
  'channel': '31'},
 {'id': 25,
  'classId': 722,
  'roomId': 270,
  'roomName': '2-205',
  'channel': '4'},
 {'id': 55,
  'classId': 723,
  'roomId': 245,
  'roomName': '1-202',
  'channel': '26'},
 {'id': 52,
  'classId': 727,
  'roomId': 273,
  'roomName': '2-208',
  'channel': '7'},
 {'id': 27,
  'classId': 735,
  'roomId': 274,
  'roomName': '2-209',
  'channel': '8'},
 {'id': 28,
  'classId': 737,
  'roomId': 271,
  'roomName': '2-206',
  'channel': '5'},
 {'id': 29,
  'classId': 742,
  'roomId': 264,
  'roomName': '1-406',
  'channel': '45'},
 {'id': 31,
  'classId': 752,
  'roomId': 290,
  'roomName': '2-408',
  'channel': '24'},
 {'id': 32,
  'classId': 753,
  'roomId': 297,
  'roomName': '2-306',
  'channel': '13'},
 {'id': 33,
  'classId': 754,
  'roomId': 302,
  'roomName': '9-308',
  'channel': '48'},
 {'id': 34,
  'classId': 755,
  'roomId': 300,
  'roomName': '2-309',
  'channel': '16'},
 {'id': 47,
  'classId': 759,
  'roomId': 299,
  'roomName': '2-308',
  'channel': '15'},
 {'id': 37,
  'classId': 760,
  'roomId': 285,
  'roomName': '2-403',
  'channel': '19'},
 {'id': 51,
  'classId': 761,
  'roomId': 298,
  'roomName': '2-307',
  'channel': '14'},
 {'id': 38,
  'classId': 763,
  'roomId': 293,
  'roomName': '2-302',
  'channel': '9'},
 {'id': 39,
  'classId': 764,
  'roomId': 294,
  'roomName': '2-303',
  'channel': '10'},
 {'id': 40,
  'classId': 765,
  'roomId': 295,
  'roomName': '2-304',
  'channel': '11'},
 {'id': 41,
  'classId': 766,
  'roomId': 291,
  'roomName': '2-409',
  'channel': '25'},
 {'id': 43,
  'classId': 768,
  'roomId': 284,
  'roomName': '2-402',
  'channel': '18'},
 {'id': 49,
  'classId': 769,
  'roomId': 288,
  'roomName': '2-406',
  'channel': '22'},
 {'id': 46,
  'classId': 770,
  'roomId': 292,
  'roomName': '2-301',
  'channel': '17'},
 {'id': 45,
  'classId': 771,
  'roomId': 296,
  'roomName': '2-305',
  'channel': '12'},
 {'id': 48,
  'classId': 777,
  'roomId': 284,
  'roomName': '2-402',
  'channel': '18'}]
In [20]:
# get(f"{ip}/school/stuface/list?teamId=106&page=1&pageSize=15&gradeId=&classId=&stuName=&stuNo=&pageNumber=0&sortField=create_time&sortOrder=asc",headers=header).json()["data"]["records"]
In [22]:
df = []
for item in data:
    stus = get(f"{ip}/school/stuface/list?teamId=106&page=1&pageSize=15&gradeId=&classId={item['classId']}&stuName=&stuNo=&pageNumber=0&sortField=create_time&sortOrder=asc",headers=header,timeout=100).json()["data"]["records"]
    for stu in stus:
        tem = {}
        value = stu.get("files",'')
        if value  and 'http' in value:
            tem["学生id"] = stu["studentId"]
            tem["faceId"] = stu["faceId"]
            tem["姓名"] = stu["stuName"]
            tem["通道号"] = item.get("channel",'')
            df.append(tem)
In [24]:
len(df)
Out [24]:
272
In [25]:
import pandas as pd
df1 = pd.DataFrame(df)
df1.to_excel("学生对应的通道号.xlsx",index=False)
---------------------------------------------------------------------------
PermissionError                           Traceback (most recent call last)
Cell In[25], line 3
      1 import pandas as pd
      2 df1 = pd.DataFrame(df)
----> 3 df1.to_excel("学生对应的通道号.xlsx",index=False)

File d:\Anaconda3\Lib\site-packages\pandas\util\_decorators.py:333, in deprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper(*args, **kwargs)
    327 if len(args) > num_allow_args:
    328     warnings.warn(
    329         msg.format(arguments=_format_argument_list(allow_args)),
    330         FutureWarning,
    331         stacklevel=find_stack_level(),
    332     )
--> 333 return func(*args, **kwargs)

File d:\Anaconda3\Lib\site-packages\pandas\core\generic.py:2417, in NDFrame.to_excel(self, excel_writer, sheet_name, na_rep, float_format, columns, header, index, index_label, startrow, startcol, engine, merge_cells, inf_rep, freeze_panes, storage_options, engine_kwargs)
   2404 from pandas.io.formats.excel import ExcelFormatter
   2406 formatter = ExcelFormatter(
   2407     df,
   2408     na_rep=na_rep,
   (...)
   2415     inf_rep=inf_rep,
   2416 )
-> 2417 formatter.write(
   2418     excel_writer,
   2419     sheet_name=sheet_name,
   2420     startrow=startrow,
   2421     startcol=startcol,
   2422     freeze_panes=freeze_panes,
   2423     engine=engine,
   2424     storage_options=storage_options,
   2425     engine_kwargs=engine_kwargs,
   2426 )

File d:\Anaconda3\Lib\site-packages\pandas\io\formats\excel.py:943, in ExcelFormatter.write(self, writer, sheet_name, startrow, startcol, freeze_panes, engine, storage_options, engine_kwargs)
    941     need_save = False
    942 else:
--> 943     writer = ExcelWriter(
    944         writer,
    945         engine=engine,
    946         storage_options=storage_options,
    947         engine_kwargs=engine_kwargs,
    948     )
    949     need_save = True
    951 try:

File d:\Anaconda3\Lib\site-packages\pandas\io\excel\_openpyxl.py:61, in OpenpyxlWriter.__init__(self, path, engine, date_format, datetime_format, mode, storage_options, if_sheet_exists, engine_kwargs, **kwargs)
     57 from openpyxl.workbook import Workbook
     59 engine_kwargs = combine_kwargs(engine_kwargs, kwargs)
---> 61 super().__init__(
     62     path,
     63     mode=mode,
     64     storage_options=storage_options,
     65     if_sheet_exists=if_sheet_exists,
     66     engine_kwargs=engine_kwargs,
     67 )
     69 # ExcelWriter replaced "a" by "r+" to allow us to first read the excel file from
     70 # the file and later write to it
     71 if "r+" in self._mode:  # Load from existing workbook

File d:\Anaconda3\Lib\site-packages\pandas\io\excel\_base.py:1246, in ExcelWriter.__init__(self, path, engine, date_format, datetime_format, mode, storage_options, if_sheet_exists, engine_kwargs)
   1242 self._handles = IOHandles(
   1243     cast(IO[bytes], path), compression={"compression": None}
   1244 )
   1245 if not isinstance(path, ExcelWriter):
-> 1246     self._handles = get_handle(
   1247         path, mode, storage_options=storage_options, is_text=False
   1248     )
   1249 self._cur_sheet = None
   1251 if date_format is None:

File d:\Anaconda3\Lib\site-packages\pandas\io\common.py:882, in get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)
    873         handle = open(
    874             handle,
    875             ioargs.mode,
   (...)
    878             newline="",
    879         )
    880     else:
    881         # Binary mode
--> 882         handle = open(handle, ioargs.mode)
    883     handles.append(handle)
    885 # Convert BytesIO or file objects passed with an encoding

PermissionError: [Errno 13] Permission denied: '学生对应的通道号.xlsx'
In [48]:
tem
Out [48]:
{'姓名': '陈松刘', '通道号': '16'}