import requests BASE_URL = "https://stultus.chipperfluff.at" class StultusUnavailable(Exception): """Raised when the stultus server is unreachable or returns an error.""" pass def _get(path: str, params: dict | list = None) -> bool: try: r = requests.get(f"{BASE_URL}/{path}", params=params, timeout=5) r.raise_for_status() return r.json().get("result", False) except Exception as e: raise StultusUnavailable(f"[STULTUS] Failed logic call to '{path}': {e}") def ping() -> bool: try: r = requests.get(f"{BASE_URL}/ping", timeout=2) return r.status_code == 200 and r.json().get("status") == "ok" except Exception: return False