-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug_api.py
More file actions
45 lines (35 loc) · 1.33 KB
/
debug_api.py
File metadata and controls
45 lines (35 loc) · 1.33 KB
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
38
39
40
41
42
43
44
45
import configparser
import json
import os
import sys
from o2_downloader import ViatomClient, SECRET
def main():
config = configparser.ConfigParser()
if not os.path.exists('o2_config.ini'):
print("o2_config.ini not found.")
return
config.read('o2_config.ini')
email = config['Settings']['email']
password = config['Settings']['password']
client = ViatomClient(SECRET)
if not client.login(email, password):
print("Login failed")
return
print("Fetching page 1...")
res = client.get_oxygen_list(page=1, size=50)
records = res.get('data', {}).get('records', [])
print("Fetching page 2...")
res2 = client.get_oxygen_list(page=2, size=50)
records.extend(res2.get('data', {}).get('records', []))
target = '2026-01-24 11:45:38'
if len(sys.argv) > 1:
target = sys.argv[1]
print(f"\n--- Records matching {target} ---")
matches = [r for r in records if r.get('measureTime') == target]
for idx, r in enumerate(matches):
print(f"\nRecord #{idx+1}:")
print(json.dumps(r, indent=2))
print(f"\nTotal matches: {len(matches)}")
print("\nTip: You can pass a specific 'YYYY-MM-DD HH:MM:SS' time as an argument to this script to search for other duplicates.")
if __name__ == '__main__':
main()