etlplus.api.endpoint_client
etlplus.api.endpoint_client module.
Endpoint client for composing URLs, requests, and pagination.
This module provides EndpointClient, a small frozen dataclass that
registers endpoint paths under a base URL, applies retry and rate-limiting
policies, and wires pagination helpers to fetch JSON records from REST APIs.
Notes
Retry-related types are re-exported by
etlplus.api.- Pagination requires a
PaginationConfig; see PagePaginationConfigDictandCursorPaginationConfigDictfor the accepted shapes.
- Pagination requires a
Examples
>>> # Page-based pagination
>>> client = EndpointClient(
... base_url="https://api.example.com/v1",
... endpoints={"list": "/items"},
... )
>>> pg = {"type": "page", "page_size": 100}
>>> rows = client.paginate("list", pagination=pg)
>>> # Cursor-based pagination
>>> pg = {
... "type": "cursor",
... "records_path": "data.items",
... "cursor_param": "cursor",
... "cursor_path": "data.nextCursor",
... "page_size": 100,
... }
>>> rows = client.paginate("list", pagination=pg)
Classes
|
Immutable registry of endpoint path templates rooted at a base URL. |