Skip to content

Client

PoliPage(*, api_key: str | None = None, base_url: str | None = None, timeout: float = 60.0, max_retries: int = 2, retry_delay: float = 0.5, on_retry=None, on_error=None, http_client=None)

Synchronous Poli Page client.

Every parameter is keyword-only and optional. api_key falls back to POLI_PAGE_API_KEY from the environment. See Configuration for the full list of options and defaults, and PoliPageOptions for every field.

The SDK ships two parallel client classes:

  • PoliPage — synchronous, backed by httpx.Client. Use as a context manager (with PoliPage(...) as client:) or call .close() to release sockets.
  • AsyncPoliPageasyncio-native, backed by httpx.AsyncClient. Use async with AsyncPoliPage(...) as client: or call await client.aclose().

The two surfaces are byte-equivalent except for async/await.

The client exposes two namespaces:

  • render — render PDFs (in memory, streaming, or to a stored document).
  • documents — fetch, preview, thumbnail, or delete stored documents.

The standalone helpers render_to_file and async_render_to_file live in poli_page.fs.