Metadata-Version: 2.4
Name: zazu-sdk
Version: 0.2.1
Summary: Python SDK for the Zazu API.
Project-URL: Homepage, https://github.com/getzazu/zazu-python
Project-URL: Documentation, https://github.com/getzazu/zazu-python#readme
Project-URL: Repository, https://github.com/getzazu/zazu-python
Project-URL: Issues, https://github.com/getzazu/zazu-python/issues
Project-URL: Changelog, https://github.com/getzazu/zazu-python/blob/main/CHANGELOG.md
Author-email: Zazu <engineering@zazu.ma>
License-Expression: MIT
License-File: LICENSE
Keywords: api,fintech,morocco,sdk,zazu
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: mypy>=1.11; extra == 'dev'
Requires-Dist: pytest-vcr>=1.0.2; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.7; extra == 'dev'
Requires-Dist: vcrpy>=6; extra == 'dev'
Description-Content-Type: text/markdown

# zazu-sdk

Python SDK for the [Zazu API](https://zazu.ma).

## Install

```bash
pip install zazu-sdk
```

Requires Python 3.11+.

## Quick start

```python
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:

```python
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`:

```python
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`](https://github.com/getzazu/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.
