Skip to main content

ApiError

An ApiClient request ended in a non-2xx response, after any retries.

Usage

Source

ApiError()

Also an httpx.HTTPStatusError, so code written for httpx catches it. The message carries the method, URL, status and response body, never a request header. request and response are the httpx objects.

Examples

try:
    client.fetch("/items/{item_id}", item_id="42")
except ApiError as err:
    if err.response.status_code != 404:
        raise