add auth check

This commit is contained in:
2026-08-03 11:16:49 +08:00
parent 6330b99860
commit 92780cedef
18 changed files with 381 additions and 242 deletions
+2 -6
View File
@@ -3,16 +3,12 @@
def heartbeat_device(timeout=5):
"""Refresh the current device's Server heartbeat and return its timestamp."""
import requests
from api import data_record_url, the_folder
from api import device_post
try:
response = requests.post(data_record_url, json={
result = device_post({
"type": "deviceHeartbeat",
"deviceId": the_folder,
}, timeout=timeout)
response.raise_for_status()
result = response.json()
except Exception as exc:
raise ValueError(f"设备心跳请求失败: {exc}") from exc
if not result.get("success"):