Skip to content

Client

archibald.client.ArchieClient

Async HTTP client for ESRI REST APIs.

Manages an internal httpx.AsyncClient with lazy initialization. Enforces f=json on all requests (preserving f=geojson when explicitly set), handles token refresh on 498/499 responses, and raises for HTTP-level errors before ESRI envelope errors are inspected.

Can be used as an async context manager or instantiated directly; in the latter case call aclose() manually when done.

__aenter__() async

Enter the async context manager.

__aexit__(*args) async

Exit the async context manager, closing the internal client.

__init__(base_url, auth, timeout=60.0)

Construct an ArchieClient.

Parameters:

Name Type Description Default
base_url str

Base URL ending in 'rest/services'.

required
auth ArcGISAuth

Authentication handler for token injection.

required
timeout float | Timeout | None

Default request timeout in seconds, an explicit httpx.Timeout for fine-grained control, or None for no timeout. Applied to all requests unless overridden per-request via kwargs.

60.0

aclose() async

Close the underlying httpx.AsyncClient if it was created.

get(endpoint=None, *, url=None, params=None, **kwargs) async

Send a GET request.

Parameters:

Name Type Description Default
endpoint str | None

Path appended to the client's base_url (or url).

None
url str | None

Override base URL for this request only.

None
params dict | None

Query parameters. f=json is enforced (f=geojson is preserved).

None
**kwargs

Forwarded to httpx.AsyncClient.request().

{}

post(endpoint=None, *, url=None, params=None, data=None, **kwargs) async

Send a POST request with a form-encoded body.

Parameters:

Name Type Description Default
endpoint str | None

Path appended to the client's base_url (or url).

None
url str | None

Override base URL for this request only.

None
params dict | None

Query parameters (not form data).

None
data dict | None

Form body. f=json is enforced here (f=geojson is preserved).

None
**kwargs

Forwarded to httpx.AsyncClient.request() (e.g. files=).

{}