import requests
def check_domain(domain: str) -> dict:
try:
resp = requests.get(
f"https://api.example.com/v1/domain/{domain}",
headers={"Authorization": f"Bearer {API_KEY}"},
timeout=10,
)
resp.raise_for_status()
return resp.json()
except requests.exceptions.Timeout:
return {"error": "timeout", "detail": "API did not respond in 10s"}
except requests.exceptions.HTTPError as e:
return {"error": "http_error", "status": resp.status_code, "detail": str(e)}
Top comments (0)