Skip to content

Retries and Error Handling

  • max_retries=3
  • initial_delay=1.0
  • max_delay=60.0
  • exponential_base=2.0
  • retry_on_rate_limit=True

Total attempts are max_retries + 1.

  1. Send request.
  2. If 429, parse Retry-After; retry if enabled and budget remains.
  3. If 5xx, retry with exponential backoff while budget remains.
  4. If 4xx (non-429), raise OdinsEyeAPIError.
  5. On success, parse JSON.
  6. On network timeout/transport errors, retry within budget.
  • OdinsEyeError: client-side failures (validation/network/non-JSON)
  • OdinsEyeAPIError: API non-2xx responses

OdinsEyeAPIError fields:

  • message
  • status_code
  • error
  • error_details
  • response_text
  • rate_limit_reset

When enable_logging=True, logs include:

  • request method/path and attempt number
  • response status code
  • rate-limit warnings
  • retry delays