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 |
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 |
None
|
max_retries
|
int
|
Automatic retry budget (default 3). See the retry policy
in :mod: |
DEFAULT_MAX_RETRIES
|
auto_throttle
|
bool
|
When |
True
|
http_client
|
Client | None
|
Custom |
None
|
Usage::
from pennylane_sdk import Pennylane
client = Pennylane()
for invoice in client.customer_invoices.list():
print(invoice.invoice_number)
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)
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
|
None
|
auto_throttle
|
bool
|
When |
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)
Asynchronous client for the Pennylane Firm API (v1), for accounting firms.
Same options as :class:PennylaneFirm.
Rate-limit state reported by the API on every response.
Attributes:
| Name | Type | Description |
|---|---|---|
limit |
int | None
|
Request budget of the current window ( |
remaining |
int | None
|
Requests left in the window ( |
reset |
int | None
|
Unix timestamp at which the window resets ( |