feat: migrate to v2-only API and unified response envelope
All checks were successful
python-syntax / syntax-check (push) Successful in 7s
All checks were successful
python-syntax / syntax-check (push) Successful in 7s
This commit is contained in:
@@ -13,23 +13,26 @@ if TOKEN:
|
||||
|
||||
|
||||
def main():
|
||||
r = requests.get(f"{BASE_URL}/health", headers=headers, timeout=10)
|
||||
r.raise_for_status()
|
||||
print("health:", r.json())
|
||||
health = requests.get(f"{BASE_URL}/health", headers=headers, timeout=10)
|
||||
health.raise_for_status()
|
||||
print("health ok:", health.json().get("ok"))
|
||||
|
||||
d = requests.get(f"{BASE_URL}/displays", headers=headers, timeout=10)
|
||||
d.raise_for_status()
|
||||
print("displays:", d.json().get("displays", []))
|
||||
|
||||
s = requests.get(
|
||||
f"{BASE_URL}/screen",
|
||||
observe = requests.post(
|
||||
f"{BASE_URL}/v2/observe",
|
||||
headers=headers,
|
||||
params={"screen": SCREEN, "with_grid": True, "grid_rows": 12, "grid_cols": 12},
|
||||
timeout=30,
|
||||
params={"screen": SCREEN},
|
||||
json={
|
||||
"mode": "screen",
|
||||
"include_image": False,
|
||||
"ocr_mode": "none",
|
||||
},
|
||||
timeout=20,
|
||||
)
|
||||
s.raise_for_status()
|
||||
payload = s.json()
|
||||
print("screen meta:", payload.get("meta", {}))
|
||||
observe.raise_for_status()
|
||||
payload = observe.json()["data"]
|
||||
print("observation_id:", payload["observation_id"])
|
||||
print("region:", payload["region"])
|
||||
print("timing_ms:", payload["timing_ms"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user