Metadata-Version: 2.4
Name: kitaboo
Version: 0.1.1
Summary: Official Kitaboo SDK for Python
License-Expression: Apache-2.0
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: httpx==0.27.2
Provides-Extra: dev
Requires-Dist: pip-audit==2.7.3; extra == 'dev'
Requires-Dist: pytest==8.3.3; extra == 'dev'
Requires-Dist: pyyaml==6.0.2; extra == 'dev'
Requires-Dist: respx==0.21.1; extra == 'dev'
Provides-Extra: examples
Requires-Dist: python-dotenv==1.0.1; extra == 'examples'
Description-Content-Type: text/markdown

# kitaboo

Official Kitaboo SDK for Python.

## Install

```bash
pip install kitaboo
```

## Quickstart

List your books and open the first one for a user:

```python
import os
from kitaboo import KitabooClient, KitabooCredentials, Region

client = KitabooClient(
    credentials=KitabooCredentials(
        client_id=os.environ["KITABOO_CLIENT_ID"],
        client_secret=os.environ["KITABOO_CLIENT_SECRET"],
    ),
    region=Region.US,
)

with client:
    first_book = None
    for book in client.books.list(pagesize=10):
        print(book.id, book.title, book.client_book_id)
        if first_book is None:
            first_book = book

    # Open the first listed book for a user. The SDK picks the microservice
    # token automatically; the user reference goes in the request body.
    user_reference_id = os.environ.get("KITABOO_USER_REFERENCE_ID")
    if first_book is None:
        print("No books returned; nothing to open.")
    elif not user_reference_id:
        print("Set KITABOO_USER_REFERENCE_ID to open the first book.")
    else:
        launch_url = client.books.launch(
            user_reference_id=user_reference_id,
            object_reference_id=first_book.client_book_id or first_book.id,
        )
        print(f"Open '{first_book.title}' at: {launch_url}")
```

`client.books.launch(...)` returns a `launchBookUrl` you can open in a browser to drop the user straight into the book.

### Environment variables

| Variable | Required | Purpose |
|---|---|---|
| `KITABOO_CLIENT_ID` | yes | OAuth client id |
| `KITABOO_CLIENT_SECRET` | yes | OAuth client secret |
| `KITABOO_USER_REFERENCE_ID` | for `books.launch` | The user opening the book |

Credentials come from environment variables — never hardcode secrets. See `examples/quickstart.py` for a runnable version that loads `python/.env` via `python-dotenv`.

## License

Apache License 2.0. See `LICENSE`.
