-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathallaccesscontrol.py
More file actions
37 lines (28 loc) · 989 Bytes
/
allaccesscontrol.py
File metadata and controls
37 lines (28 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from datetime import datetime, timedelta
import requests
from requests.auth import HTTPDigestAuth
username = "admin"
password = "123456"
auth = HTTPDigestAuth(username, password)
url = "http://IP/ISAPI/AccessControl/AcsEvent?format=json"
start_datetime = datetime(2025, 1, 1, 0, 0)
end_datetime = datetime(2025, 1, 1, 23, 59)
chunk_hours = 2
current_start = start_datetime
while current_start < end_datetime:
current_end = min(current_start + timedelta(hours=chunk_hours), end_datetime)
data = {
"AcsEventCond": {
"searchID": "1",
"searchResultPosition": 0,
"maxResults": 30,
"major": 5,
"minor": 75,
"startTime": current_start.isoformat(),
"endTime": current_end.isoformat()
}
}
print(f"Запрос: {current_start} — {current_end}")
response = requests.post(url, json=data, auth=auth, timeout=30)
print(response.text)
current_start = current_end