Skip to main content

Official Kitaboo SDK for Python

Project description

kitaboo

Official Kitaboo SDK for Python.

Install

pip install kitaboo

Quickstart

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

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.

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

kitaboo-0.1.1.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

kitaboo-0.1.1-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file kitaboo-0.1.1.tar.gz.

File metadata

  • Download URL: kitaboo-0.1.1.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for kitaboo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 64c0d8c65c31f2a13bdbb0d9638f65df146bcfb471ca7ac348a67bf4a3a4d5ec
MD5 f4518d5f1622ef4ad39177fd8a745abd
BLAKE2b-256 ef4bc97b62aa4b1aabc4b3ceed7409478b0be2c4174e95044ab3c6ee3b35c352

See more details on using hashes here.

File details

Details for the file kitaboo-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: kitaboo-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for kitaboo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2e6908c5e011cb7b9e87f373ecd204767135dcaeb89f1e09b5e77abb7f77e714
MD5 fa67d728b382a070328dcf5db8deaaf7
BLAKE2b-256 39ce19436c5e8c7e91a7f27d4080209cf110219b23cdc0513913136ce65d8a9b

See more details on using hashes here.

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