Files
python----/智慧校园/智慧校园-1.ipynb
2025-10-20 12:32:18 +08:00

4.6 KiB

In [1]:
from requests import get,post
In [2]:
from requests import get,post
import time
ip = "http://band.hxzhxy.cn"
# ip = "http://192.168.0.244:8100"

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}",
}
In [13]:
# ip = "http://band.hxzhxy.cn"
ip = "http://192.168.0.205:8090"
post(f"{ip}/httpLock/log",json={'lockId': '8686987', 'notifyType': '1', 'records': '[{"lockId":8686987,"electricQuantity":100,"serverDate":1758100706693,"recordTypeFromLock":17,"recordType":7,"success":1,"lockMac":"FD:15:3A:7E:D1:E2","keyboardPwd":"3157220353","lockDate":1758100692000,"username":"夏天乐带0"}]', 'admin': 'xtlft@qq.com', 'lockMac': 'FD:15:3A:7E:D1:E2'}).json()
Out [13]:
{'success': True, 'msg': '操作成功', 'code': 0, 'data': '接收成功'}
In [ ]:
import datetime
s = int(datetime.datetime(2025,9,15).timestamp()*1000)
e = int(datetime.datetime(2025,9,19).timestamp()*1000)
In [8]:
data = post(f"{ip}/lock/log/exportExcelStuCount",params={"teamId":110,"startTime":s,"endTime":e},headers=header)
In [10]:
with open ("1.xlsx","wb") as f:
    f.write(data.content)
In [5]:
get(f"{ip}/oauth/token",params=param)
Out [5]:
<Response [200]>
In [3]:
for i in range(24,27):
    print(post(f"{ip}/classAttendStu/createThisWeek",headers=header,params={"planId":i},timeout=600).text)
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.4.0</center>
</body>
</html>

<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.4.0</center>
</body>
</html>

{"success":false,"msg":"系统错误","code":10000,"data":null}
In [13]:
print(post(f"{ip}/classAttendStu/createThisWeek",headers=header,params={"planId":31},timeout=600).text)
{"success":false,"msg":"系统错误","code":10000,"data":null}