Skip to content

Authentication

The Poli Page Python SDK authenticates every request with a bearer token. The key prefix determines which environment the request hits.

Pass the key to the client constructor, or let the SDK pick it up from POLI_PAGE_API_KEY:

import os
from poli_page import PoliPage
# Explicit:
client = PoliPage(api_key=os.environ["POLI_PAGE_API_KEY"])
# Implicit — same env var, fewer characters:
client = PoliPage()

If no key is provided either way, the constructor raises PoliPageError(code="invalid_options").

import os
from poli_page import PoliPage
client = PoliPage(api_key=os.environ["POLI_PAGE_API_KEY"])