pypresscart.client¶
Top-level PresscartClient — the public entry point for the SDK.
Classes
|
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:
objectHTTP 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 withas_json=True.user_agent (str | None) – Custom
User-Agentheader.session (requests.Session | None) – Pre-configured
requests.Sessionto reuse.