Configuration
The PoliPage and AsyncPoliPage constructors accept keyword-only arguments. Every parameter is optional — when api_key is omitted the SDK reads POLI_PAGE_API_KEY from the environment.
Available options
Section titled “Available options”api_key— yourpp_test_orpp_live_key. Required at runtime; falls back toPOLI_PAGE_API_KEY.base_url— override the API endpoint. Defaults tohttps://api.poli.page(orPOLI_PAGE_BASE_URL).timeout— per-request timeout in seconds. Defaults to60.0.max_retries— maximum retry attempts for retryable errors. Defaults to2(three total attempts).retry_delay— initial retry backoff in seconds. Defaults to0.5. Doubles each attempt.on_retry/on_error— observability hooks. Sync callables; never block, never mutate requests.http_client— inject your ownhttpx.Client(sync) orhttpx.AsyncClient(async) for proxies, custom TLS, shared pools, or test transports. Caller-owned clients are not closed onclose()/aclose().
Example
Section titled “Example”import osfrom poli_page import PoliPage
client = PoliPage( api_key=os.environ["POLI_PAGE_API_KEY"], timeout=30.0, max_retries=3, retry_delay=0.25, on_retry=lambda event: print(f"retry {event.attempt} in {event.delay_seconds:.2f}s"), on_error=lambda err: print(f"failed: {err.code}"),)