pypresscart.client

Top-level PresscartClient — the public entry point for the SDK.

Classes

PresscartClient(api_token, *[, base_url, ...])

HTTP client for the Presscart API.

class pypresscart.client.PresscartClient(api_token, *, base_url='https://api.presscart.com', timeout=30.0, max_retries=3, retry_backoff_base=0.25, retry_backoff_max=4.0, retry_jitter=0.1, response_mode='pydantic', user_agent=None, session=None)[source]

Bases: object

HTTP client for the Presscart API.

Example

>>> client = PresscartClient(api_token="pc_...")
>>> whoami = client.auth.whoami()
>>> outlets = client.outlets.list(limit=10)
Parameters:
  • api_token (str) – Bearer token. Required.

  • base_url (str) – API base URL. Defaults to https://api.presscart.com.

  • timeout (float) – Per-request timeout in seconds.

  • max_retries (int) – Additional attempts on 429/5xx/network errors.

  • retry_backoff_base (float) – Base seconds for exponential backoff.

  • retry_backoff_max (float) – Max backoff cap.

  • retry_jitter (float) – Fractional jitter added to each backoff.

  • response_mode (ResponseMode) – "pydantic" (default) returns typed models; "json" returns raw dicts. Individual method calls may override with as_json=True.

  • user_agent (str | None) – Custom User-Agent header.

  • session (requests.Session | None) – Pre-configured requests.Session to reuse.

close()[source]

Close the underlying session if we own it.

Return type:

None