Skip to main content

pyolivetree

Python client for the Olive Tree Bible APIs. Use it to pull your notes and highlights, browse your library, query Smart Search AI, and more.

Install

pip install pyolivetree
cp .env.example .env             # put your Olive Tree email + password in it

Client

from pyolivetree import DataSet, OliveTree

with OliveTree() as ot:              # logs in on first call that needs it
    ot.sync.status()                 # latest change numbers for your data
    for row in ot.sync.pull(DataSet.ANNOTATIONS):   # or "annotations"
        print(row["table_name"], row["datum"].get("title"))

    owned = list(ot.store.all_products(ot.store.purchased()))
    ot.store.product(36163)          # product details
    ot.products.download_links(36163)  # XML with product download URLs
    ot.ai.query("What does the Bible say about patience?", books=["James"])
    ot.reading.verse_of_the_day("2026-11-08")
    ot.media.cover(36163)            # bytes (JPEG)

Convenience methods

with OliveTree() as ot:
    ot.backup()              # mirror sync data into olivetree.db; later runs fetch only changes
    ot.notes()               # your notes in Bible order (syncs annotation changes first)
    ot.highlights()          # highlights, with the highlighter color
    ot.clips()               # verse text you saved
    ot.status()              # sync server status and change numbers
    ot.library()             # every product you own, across all pages

notes, highlights and clips take db="olivetree.db" and refresh=True; pass refresh=False to read the local backup offline. Each item is the row's fields (title, content, created_date, …) plus type, ref (e.g. "John 3:16-17") and color. pyolivetree.to_markdown(items) renders any of them as Markdown.

Async, with the same groups and methods:

import asyncio
from pyolivetree import AsyncOliveTree

async def main():
    async with AsyncOliveTree() as ot:
        home = await ot.store.home()
        notes = await ot.sync.pull("annotations")   # list

asyncio.run(main())

The 1.x names still work: OliveTreeClient, AsyncOliveTreeClient, install_id=, and a-prefixed async methods (await client.store.ahome()). See examples/.

Data sets are DataSet.ANNOTATIONS, LIBRARY, DAILY_READING and BOOKSHELF. Every sync method and backup() also accept the plain name ("library") or the server name ("managed_library").

Responses come back as JSON (dict/list), str for XML/HTML, or bytes for images. Errors raise OliveTreeAuthError (login/401) or OliveTreeAPIError (other HTTP errors), both subclasses of OliveTreeError with .status, .code and .body. An expired token triggers one automatic re-login. ot.request(method, url, ...) reaches anything not wrapped.

Group Methods
ot.account login, access_token, refresh_token, signup, forgot_password, web_handoff_token, subscription, add_variable_subscription_selections
ot.store home, banner, featured_categories, library, purchased, wishlists, search, category, product, products, library_details, all_products, path, subscriptions_available, first_run_*, need_interests, paid_features, paid_features_marketing, ads, product_manifest, giveaway, allow_subscription_purchase, subscription_variable_product_selection, wishlist_add, wishlist_remove, register_subscription, validate_google_in_app_purchase, support_delete_account
ot.products download_links, info, register, updates, email_signup, reading_templates
ot.sync status, page, pull, table_schema, push, release_lock, possibly_bad_annotation_data
ot.ai query, status, set_usage, models
ot.reading daily_reading, recommended, verse_of_the_day, verse_of_the_day_image, now_reading, completed_message
ot.media cover, cover_stack, product_image, reading_plan_image, reading_plan_list_image, stream
ot.messages list, register_device, metrics
ot.telemetry event_manifest, get_variant, set_variant, events, session_start, consent_receipt, location_settings, subscription_log_usage
ot.web timeouts, appirater_config, app_to_web_bridge, product_page, bible_study_packs, manage_subscriptions, eula, privacy_policy, help_articles, help_login
ot.firebase get, root

Calls that change your account: sync.push, store.wishlist_*, store.register_subscription, store.validate_google_in_app_purchase, store.support_delete_account (irreversible), account.signup, ai.set_usage, and the telemetry POSTs.

Notes backup and export

pyolivetree backup                   # mirror your sync data into olivetree.db (re-runs fetch only changes)
pyolivetree notes --out notes.md     # your notes as Markdown, grouped by Bible book (from the backup)
pyolivetree notes --refresh          # sync changes first, then export
pyolivetree highlights --out highlights.md
pyolivetree clips                    # verse text you saved
pyolivetree library                  # every product you own (JSON)
pyolivetree status                   # sync server status (JSON)
from pyolivetree import OliveTree, to_markdown
with OliveTree() as ot:
    print(to_markdown(ot.notes()))

olivetree.db is SQLite: every row is in syncables (table_name, datum JSON).

How auth works

  • Login: POST /store/br5/app/json/account/account_login returns authentication_token. The client sends it as OTAuthorization: Bearer <token>.
  • Store/account form posts include standard client fields (install_id, platform, ReaderVersion, supportsProductDRM, …). Without them, purchased comes back empty.
  • Signed endpoints (ai, messages, telemetry.events, session_start) add a signature header: uppercase-hex HMAC-SHA512 of the body, using the client keys in constants.py. Set OLIVE_TREE_HMAC_KEY (hex or base64) or pass hmac_key= to use one key for everything.
  • ot.request(..., basic=True) sends HTTP Basic auth with your username and password.

Known gaps

  • messages.list returns 401 until a device is registered via messages.register_device. The body format for that call isn't confirmed.
  • sync.possibly_bad_annotation_data is currently rejected by the server (401/410); firebase reads are refused (423/401); the help-center pages may return 403 to non-browser clients.
  • Purchased books (study Bibles included) download as encrypted files. This client gets the download links but doesn't decrypt them.

Development

Needs uv.

make install       # .venv with dev + docs extras
make test          # pytest
make coverage      # pytest with coverage report
make lint          # ruff check
make format        # ruff format + black
make docs          # Sphinx HTML in docs/_build/html
make security      # dependency vulnerability scan
make run           # run examples/sync_basic.py
make build check   # build sdist/wheel and validate with twine
make publish-test  # upload to TestPyPI (token in ~/.pypirc)
make publish       # upload to PyPI (token in ~/.pypirc)

Layout: client.py (auth, request, signing), async_client.py, resources/ (one module per endpoint group), notes.py (backup + Markdown), cli.py, constants.py, exceptions.py. The OpenAPI description is in swagger.yml; the docs manual is in docs/manual/.

Metadata

Release files for pyolivetree 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyolivetree 2.0.1
File Size Uploaded Provenance Actions
pyolivetree-2.0.1.tar.gz 25.3 kB Without provenance Details for pyolivetree-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyolivetree 2.0.1
File Interpreter ABI Platform Actions
pyolivetree-2.0.1-py3-none-any.whl Python 3 none any Details for pyolivetree-2.0.1-py3-none-any.whl

Total release size: 59.7 kB

Release files / pyolivetree-2.0.1.tar.gz

Download URL pyolivetree-2.0.1.tar.gz
Size 25.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b28b36eda9ecea95bda8831b4ac3998820164f20793df734e4c7823c4fe1820e
BLAKE2b-256 checksum
How to use checksums
31937e7d7f50d1e95087b0f742a415aee477ce29b2c90d49fd4e7d6fe0a18fb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / pyolivetree-2.0.1-py3-none-any.whl

Download URL pyolivetree-2.0.1-py3-none-any.whl
Size 34.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1bc3b35febcbd3ca991ac4248f0a338e58be1d6e8c5ce9e71bb8eb91e26a7f5
BLAKE2b-256 checksum
How to use checksums
bd99069160f81c4d1471a56637395f93f9513ebd50ca6856bf1d15fb75eea150
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Security for pyolivetree 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page