"""Read-only HTTP smoke checks. No frame writes; token read from env/private .env.""" import json import os from pathlib import Path from urllib.request import Request, urlopen base = os.getenv("FRAME_FLOW_URL", "http://127.0.0.1:18787").rstrip("/") token = os.getenv("FRAME_FLOW_TOKEN", "") if not token and Path(".env").exists(): for line in Path(".env").read_text().splitlines(): if line.startswith("FRAME_FLOW_TOKEN="): token = line.split("=", 1)[1] for path in [ "/health", "/ready", "/api/v1/version", "/openapi.json", "/docs", "/", "/api/v1/devices", "/api/v1/templates", "/api/v1/jobs", ]: request = Request(base + path, headers={"Authorization": "Bearer " + token}) with urlopen(request, timeout=15) as response: body = response.read() print(path, "HTTP", response.status, "bytes", len(body)) assert response.status == 200 # A restored job is not usable merely because the scheduler is ready. request = Request( base + "/api/v1/photo-sources", headers={"Authorization": "Bearer " + token} ) with urlopen(request, timeout=15) as response: sources = json.load(response) if any(source.get("enabled") and source.get("people_filter") for source in sources): request = Request( base + "/api/v1/integrations/synology-photos", headers={"Authorization": "Bearer " + token}, ) with urlopen(request, timeout=15) as response: photos = json.load(response) if not photos.get("configured") or not photos.get("connected"): raise RuntimeError( "Enabled people-filtered photo source requires Photos connection" ) print("Synology Photos dependency configured and connected") print("Read-only smoke checks passed")