#!/usr/bin/env python3 """Observable data loader: recent progress events (last 200).""" import json import os import urllib.request import urllib.error API_BASE = os.environ.get("API_BASE", "http://127.0.0.1:8000").rstrip("/") try: url = f"{API_BASE}/progress?limit=200" with urllib.request.urlopen(url, timeout=10) as resp: data = json.loads(resp.read()) print(json.dumps(data)) except urllib.error.URLError as e: print(json.dumps({"error": str(e), "events": []}))