Skip to main content

Python SDK for the Zazu API.

Project description

zazu-sdk

Python SDK for the Zazu API.

Install

pip install zazu-sdk

Requires Python 3.11+.

Quick start

from zazu_sdk import Zazu

client = Zazu(api_key="sk_live_...")

client.entity.get()
client.accounts.list(currency_code="MAD")
client.customers.list(q="Acme")
client.customers.create(
    customer_type="business",
    company_name="Acme Corp",
    email="billing@acme.com",
)

client.invoices.list()
client.payment_links.cancel(payment_link_id)
client.webhook_endpoints.list()

client.checkout_sessions.create(
    account_id=account_id,
    amount="100.00",
    success_url="https://example.com/ok",
    cancel_url="https://example.com/cancel",
)
client.checkout_sessions.get(session_id)

The client picks up ZAZU_API_KEY, ZAZU_BASE_URL, ZAZU_API_VERSION, and ZAZU_TIMEOUT from the environment if you don't pass them.

Pagination

List endpoints return a Page. Iterate one page or chase cursors:

page = client.invoices.list(limit=25)
for invoice in page:
    ...

# All items, automatic cursor chasing:
for invoice in client.invoices.list().auto_paging_iter():
    ...

Errors

Nine concrete subclasses; discriminate with isinstance:

from zazu_sdk import (
    ZazuValidationError,
    ZazuRateLimitError,
    ZazuNotFoundError,
)

try:
    client.invoices.get("nope")
except ZazuNotFoundError as err:
    print(err.status, err.request_id, err.body)
except ZazuRateLimitError as err:
    print("retry after", err.retry_after, "seconds")

Cross-SDK contract

zazu-sdk is one of several Zazu SDKs that all replay cassettes recorded by the canonical zazu-ruby SDK against staging. The wire format is snake_case JSON; request and response shapes match across Ruby, TypeScript, Python, Go, and Rust.

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zazu_sdk-0.2.1.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zazu_sdk-0.2.1-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file zazu_sdk-0.2.1.tar.gz.

File metadata

  • Download URL: zazu_sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zazu_sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f526e14845abdbd89279c5bdd045de17e19374f5dd310edeb1778ac1613ad2b1
MD5 4485a2201da414ada77d1eb96dd6f9b2
BLAKE2b-256 51b1cffa0a2ca9d34e0c7c130c53d587f5b90d921958831ee1b5a96d0421ffd5

See more details on using hashes here.

Provenance

The following attestation bundles were made for zazu_sdk-0.2.1.tar.gz:

Publisher: release.yml on getzazu/zazu-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zazu_sdk-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: zazu_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zazu_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a89e42d95b2e7c08a2bbde9e6e5c05e82e398eaa32dd0c13c6c0234ad5632fd4
MD5 9ddd5c77222838131837213ba67a9a70
BLAKE2b-256 eb219204c9736b556efb86eaf16634e2bfedbfce6fa8f61bbbe9674d03bf1e0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for zazu_sdk-0.2.1-py3-none-any.whl:

Publisher: release.yml on getzazu/zazu-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page