Skip to content

Clients

The four entry points of the SDK. Company clients expose one attribute per API resource (client.customer_invoices, client.products, ...); Firm clients do the same for the firm-scoped resources.

Synchronous client for the Pennylane Company API (v2).

Parameters:

Name Type Description Default
api_token str | None

Company API token. Falls back to the PENNYLANE_API_TOKEN environment variable.

None
base_url str | None

Override the API base URL (e.g. for a proxy).

None
timeout float | Timeout | None

Request timeout in seconds or an httpx.Timeout (default 60s).

None
max_retries int

Automatic retry budget (default 3). See the retry policy in :mod:pennylane_sdk._base_client.

DEFAULT_MAX_RETRIES
auto_throttle bool

When True (default), outgoing requests are paced client-side to the official limit of 25 requests per 5 seconds so bulk operations never hit HTTP 429.

True
http_client Client | None

Custom httpx.Client (advanced: proxies, transports...).

None

Usage::

from pennylane_sdk import Pennylane

client = Pennylane()
for invoice in client.customer_invoices.list():
    print(invoice.invoice_number)

last_rate_limit property

last_rate_limit: RateLimitInfo | None

Rate-limit state from the most recent API response.

close

close() -> None

Release the underlying HTTP connection pool.

Asynchronous client for the Pennylane Company API (v2).

Same options as :class:Pennylane. Usage::

from pennylane_sdk import AsyncPennylane

async with AsyncPennylane() as client:
    page = await client.customer_invoices.list()
    async for invoice in page:
        print(invoice.invoice_number)

last_rate_limit property

last_rate_limit: RateLimitInfo | None

Rate-limit state from the most recent API response.

close async

close() -> None

Release the underlying HTTP connection pool.

Synchronous client for the Pennylane Firm API (v1), for accounting firms.

Parameters:

Name Type Description Default
api_token str | None

Firm API token. Falls back to the PENNYLANE_FIRM_API_TOKEN environment variable.

None
auto_throttle bool

When True (default), paces requests to the official Firm API limit of 5 requests per second.

True

Other options are identical to :class:Pennylane. Usage::

from pennylane_sdk import PennylaneFirm

firm = PennylaneFirm()
for company in firm.companies.list():
    print(company.name)

last_rate_limit property

last_rate_limit: RateLimitInfo | None

Rate-limit state from the most recent API response.

close

close() -> None

Release the underlying HTTP connection pool.

Asynchronous client for the Pennylane Firm API (v1), for accounting firms.

Same options as :class:PennylaneFirm.

last_rate_limit property

last_rate_limit: RateLimitInfo | None

Rate-limit state from the most recent API response.

close async

close() -> None

Release the underlying HTTP connection pool.

Rate-limit state reported by the API on every response.

Attributes:

Name Type Description
limit int | None

Request budget of the current window (ratelimit-limit).

remaining int | None

Requests left in the window (ratelimit-remaining).

reset int | None

Unix timestamp at which the window resets (ratelimit-reset).