DataMaxi+ API¶
API
¶
API(
api_key=None,
base_url=None,
timeout=10,
proxies=None,
show_limit_usage=False,
show_header=False,
max_retries=3,
retry_backoff=0.5,
retry_statuses=(502, 503, 504),
)
Bases: object
The base class for all DataMaxi+ Python clients. api_key can be set
as an environment variable DATAMAXI_API_KEY.
Parameters:
-
api_key(str, default:None) –The API key for the DataMaxi+ API.
-
base_url(str, default:None) –The base URL for the DataMaxi+ API.
-
timeout(int, default:10) –The timeout for the requests.
-
proxies(dict, default:None) –The proxies for the requests.
-
show_limit_usage(bool, default:False) –Deprecated. Metadata is now always available via
last_response; this flag no longer changes the return shape. Kept for backward compatibility. -
show_header(bool, default:False) –Deprecated. See
show_limit_usage/last_response. -
max_retries(int, default:3) –Retry attempts for transient gateway 5xx and connection/read errors. Set to 0 to disable.
-
retry_backoff(float, default:0.5) –Backoff factor between retries (seconds); see urllib3
Retry(backoff_factor=...). -
retry_statuses(tuple, default:(502, 503, 504)) –HTTP status codes treated as transient and retried (GET only).
request_endpoint
¶
request_endpoint(op_id, **params)
Dispatch a request described by the generated endpoint registry.
Looks up op_id in datamaxi._endpoints.ENDPOINTS (regenerated
from the backend OpenAPI spec by datamaxi-codegen) and uses it as the
single source of truth for the URL path, HTTP method, path/query split,
required params, and default values. Callers pass wire-level parameter
names as keyword arguments (e.g. **{"from": from_unix}); semantic
validation and response shaping stay in the calling client method.
The resolution itself lives in datamaxi._dispatch.resolve_endpoint
so the async client reuses identical param handling.
ResponseMeta
¶
ResponseMeta(status_code, headers, limit_usage, data)
Bases: object
Metadata for the most recent successful response.
Exposed via client.<resource>.last_response so per-call info
(rate-limit usage, headers, status) no longer has to be wrapped into —
and change the shape of — the returned payload. The client tree shares
one transport, so this reflects the last call made through it.
Resource
¶
Resource(api_key=None, api=None, **kwargs)
Bases: object
Base for endpoint/resource clients — composes an API transport
rather than subclassing it.
Every resource holds a shared API (one requests.Session /
connection pool) instead of each opening its own. A resource either
receives an already-built api (the normal path — Datamaxi
constructs one and threads it through the whole tree via **kwargs)
or builds its own from api_key/**kwargs for direct, standalone
instantiation. The thin request_endpoint/query forwarders keep the
call sites in the resource methods unchanged (self.request_endpoint(...)).
last_response
property
¶
last_response
ResponseMeta for the most recent call through the shared transport.