pyolivetree 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyolivetree/__init__.py +37 -0
- pyolivetree/__main__.py +3 -0
- pyolivetree/_http.py +116 -0
- pyolivetree/async_client.py +131 -0
- pyolivetree/cli.py +42 -0
- pyolivetree/client.py +273 -0
- pyolivetree/constants.py +101 -0
- pyolivetree/exceptions.py +35 -0
- pyolivetree/notes.py +174 -0
- pyolivetree/py.typed +0 -0
- pyolivetree/resources/__init__.py +27 -0
- pyolivetree/resources/_base.py +20 -0
- pyolivetree/resources/account.py +117 -0
- pyolivetree/resources/ai.py +41 -0
- pyolivetree/resources/firebase.py +24 -0
- pyolivetree/resources/media.py +44 -0
- pyolivetree/resources/messages.py +46 -0
- pyolivetree/resources/products.py +55 -0
- pyolivetree/resources/reading.py +53 -0
- pyolivetree/resources/store.py +185 -0
- pyolivetree/resources/sync.py +156 -0
- pyolivetree/resources/telemetry.py +63 -0
- pyolivetree/resources/web.py +61 -0
- pyolivetree-2.0.0.dist-info/METADATA +168 -0
- pyolivetree-2.0.0.dist-info/RECORD +28 -0
- pyolivetree-2.0.0.dist-info/WHEEL +4 -0
- pyolivetree-2.0.0.dist-info/entry_points.txt +2 -0
- pyolivetree-2.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pyolivetree
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Python client for the Olive Tree Bible app APIs: notes, highlights, library, Smart Search
|
|
5
|
+
Author: Taiwo Kareem
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: api-client,bible,bible-study,notes,olivetree
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Intended Audience :: Religion
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Religion
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: httpx>=0.27
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: black>=24; extra == 'dev'
|
|
27
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest-cov>=5; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
31
|
+
Requires-Dist: twine>=5; extra == 'dev'
|
|
32
|
+
Provides-Extra: docs
|
|
33
|
+
Requires-Dist: furo>=2024.1; extra == 'docs'
|
|
34
|
+
Requires-Dist: sphinx>=7; extra == 'docs'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# pyolivetree
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install pyolivetree
|
|
45
|
+
cp .env.example .env # put your Olive Tree email + password in it
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Client
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from pyolivetree import DataSet, OliveTree
|
|
52
|
+
|
|
53
|
+
with OliveTree() as ot: # logs in on first call that needs it
|
|
54
|
+
ot.sync.status() # latest change numbers for your data
|
|
55
|
+
for row in ot.sync.pull(DataSet.ANNOTATIONS): # or "annotations"
|
|
56
|
+
print(row["table_name"], row["datum"].get("title"))
|
|
57
|
+
|
|
58
|
+
owned = list(ot.store.all_products(ot.store.purchased()))
|
|
59
|
+
ot.store.product(36163) # product details
|
|
60
|
+
ot.products.download_links(36163) # XML with product download URLs
|
|
61
|
+
ot.ai.query("What does the Bible say about patience?", books=["James"])
|
|
62
|
+
ot.reading.verse_of_the_day("2026-11-08")
|
|
63
|
+
ot.media.cover(36163) # bytes (JPEG)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Convenience methods
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
with OliveTree() as ot:
|
|
70
|
+
ot.backup() # mirror sync data into olivetree.db; later runs fetch only changes
|
|
71
|
+
ot.notes() # your notes in Bible order (syncs annotation changes first)
|
|
72
|
+
ot.highlights() # highlights, with the highlighter color
|
|
73
|
+
ot.clips() # verse text you saved
|
|
74
|
+
ot.status() # sync server status and change numbers
|
|
75
|
+
ot.library() # every product you own, across all pages
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`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.
|
|
79
|
+
|
|
80
|
+
Async, with the same groups and methods:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
import asyncio
|
|
84
|
+
from pyolivetree import AsyncOliveTree
|
|
85
|
+
|
|
86
|
+
async def main():
|
|
87
|
+
async with AsyncOliveTree() as ot:
|
|
88
|
+
home = await ot.store.home()
|
|
89
|
+
notes = await ot.sync.pull("annotations") # list
|
|
90
|
+
|
|
91
|
+
asyncio.run(main())
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The 1.x names still work: `OliveTreeClient`, `AsyncOliveTreeClient`, `install_id=`, and `a`-prefixed async methods (`await client.store.ahome()`). See [examples/](examples/).
|
|
95
|
+
|
|
96
|
+
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"`).
|
|
97
|
+
|
|
98
|
+
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.
|
|
99
|
+
|
|
100
|
+
| Group | Methods |
|
|
101
|
+
|---|---|
|
|
102
|
+
| `ot.account` | `login`, `access_token`, `refresh_token`, `signup`, `forgot_password`, `web_handoff_token`, `subscription`, `add_variable_subscription_selections` |
|
|
103
|
+
| `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` |
|
|
104
|
+
| `ot.products` | `download_links`, `info`, `register`, `updates`, `email_signup`, `reading_templates` |
|
|
105
|
+
| `ot.sync` | `status`, `page`, `pull`, `table_schema`, `push`, `release_lock`, `possibly_bad_annotation_data` |
|
|
106
|
+
| `ot.ai` | `query`, `status`, `set_usage`, `models` |
|
|
107
|
+
| `ot.reading` | `daily_reading`, `recommended`, `verse_of_the_day`, `verse_of_the_day_image`, `now_reading`, `completed_message` |
|
|
108
|
+
| `ot.media` | `cover`, `cover_stack`, `product_image`, `reading_plan_image`, `reading_plan_list_image`, `stream` |
|
|
109
|
+
| `ot.messages` | `list`, `register_device`, `metrics` |
|
|
110
|
+
| `ot.telemetry` | `event_manifest`, `get_variant`, `set_variant`, `events`, `session_start`, `consent_receipt`, `location_settings`, `subscription_log_usage` |
|
|
111
|
+
| `ot.web` | `timeouts`, `appirater_config`, `app_to_web_bridge`, `product_page`, `bible_study_packs`, `manage_subscriptions`, `eula`, `privacy_policy`, `help_articles`, `help_login` |
|
|
112
|
+
| `ot.firebase` | `get`, `root` |
|
|
113
|
+
|
|
114
|
+
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.
|
|
115
|
+
|
|
116
|
+
## Notes backup and export
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
pyolivetree backup # mirror your sync data into olivetree.db (re-runs fetch only changes)
|
|
120
|
+
pyolivetree notes --out notes.md # your notes as Markdown, grouped by Bible book (from the backup)
|
|
121
|
+
pyolivetree notes --refresh # sync changes first, then export
|
|
122
|
+
pyolivetree highlights --out highlights.md
|
|
123
|
+
pyolivetree clips # verse text you saved
|
|
124
|
+
pyolivetree library # every product you own (JSON)
|
|
125
|
+
pyolivetree status # sync server status (JSON)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
from pyolivetree import OliveTree, to_markdown
|
|
130
|
+
with OliveTree() as ot:
|
|
131
|
+
print(to_markdown(ot.notes()))
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
`olivetree.db` is SQLite: every row is in `syncables` (`table_name`, `datum` JSON).
|
|
135
|
+
|
|
136
|
+
## How auth works
|
|
137
|
+
|
|
138
|
+
- Login: `POST /store/br5/app/json/account/account_login` returns `authentication_token`. The client sends it as `OTAuthorization: Bearer <token>`.
|
|
139
|
+
- Store/account form posts include standard client fields (`install_id`, `platform`, `ReaderVersion`, `supportsProductDRM`, …). Without them, `purchased` comes back empty.
|
|
140
|
+
- 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.
|
|
141
|
+
- `ot.request(..., basic=True)` sends HTTP Basic auth with your username and password.
|
|
142
|
+
|
|
143
|
+
## Known gaps
|
|
144
|
+
|
|
145
|
+
- `messages.list` returns 401 until a device is registered via `messages.register_device`. The body format for that call isn't confirmed.
|
|
146
|
+
- `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.
|
|
147
|
+
- Purchased books (study Bibles included) download as encrypted files. This client gets the download links but doesn't decrypt them.
|
|
148
|
+
|
|
149
|
+
## Development
|
|
150
|
+
|
|
151
|
+
Needs [uv](https://docs.astral.sh/uv/).
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
make install # .venv with dev + docs extras
|
|
155
|
+
make test # pytest
|
|
156
|
+
make coverage # pytest with coverage report
|
|
157
|
+
make lint # ruff check
|
|
158
|
+
make format # ruff format + black
|
|
159
|
+
make docs # Sphinx HTML in docs/_build/html
|
|
160
|
+
make security # dependency vulnerability scan
|
|
161
|
+
make run # run examples/sync_basic.py
|
|
162
|
+
make build check # build sdist/wheel and validate with twine
|
|
163
|
+
make publish-test # upload to TestPyPI (token in ~/.pypirc)
|
|
164
|
+
make publish # upload to PyPI (token in ~/.pypirc)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Layout: `client.py` (auth, request, signing), `async_client.py`, `resources/` (one module per endpoint group),
|
|
168
|
+
`notes.py` (backup + Markdown), `cli.py`, `constants.py`, `exceptions.py`. The OpenAPI description is in `swagger.yml`; the docs manual is in `docs/manual/`.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
pyolivetree/__init__.py,sha256=MhUOuNhSX1teoMyLV4JbE92Dq7BA11IREqhx4zseBFI,1038
|
|
2
|
+
pyolivetree/__main__.py,sha256=1LmbyB6YnxgI4WbgBkuBhUngNqwZLnc_P9Q3PT8j3uQ,41
|
|
3
|
+
pyolivetree/_http.py,sha256=rZDmkIaZZi_MJYkdCQ-aTc2WbcX2IwchNtiU1ywxs68,3631
|
|
4
|
+
pyolivetree/async_client.py,sha256=Q-BSI6tBH_iF24HK4I50V5NLeDXYeeOKrI5AliDJLkw,4732
|
|
5
|
+
pyolivetree/cli.py,sha256=uW8jDA5ndhEu47AOa73J6U7e3FM-0kAIokugGZaoMhU,1670
|
|
6
|
+
pyolivetree/client.py,sha256=urKIbQn-A3qwrh-BcLJQ8qIMFtMd8EgP9Pe1GRUXuu8,11157
|
|
7
|
+
pyolivetree/constants.py,sha256=f9sk39RSOkn0zVTddn9zS5FNIfIxCqiFSH3Gu_uwkAc,3629
|
|
8
|
+
pyolivetree/exceptions.py,sha256=b08Ps9zBX0zwJ6V0Lhb8C6Kx4bVtdxcX4dqRsxeOMvk,1071
|
|
9
|
+
pyolivetree/notes.py,sha256=KyQf9v534FRI_5CGjKpLW4YsIBY-ytpXEMifPlSUjUY,7271
|
|
10
|
+
pyolivetree/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
+
pyolivetree/resources/__init__.py,sha256=_IyYNLpU9FX8SHW-ZqnQqbuGuJP9aHYW2U8QhbJoEVQ,790
|
|
12
|
+
pyolivetree/resources/_base.py,sha256=nsfBXK12Y7bQAcnAN5Ap-mK0BSAR6kw-SNNncWNJdJI,527
|
|
13
|
+
pyolivetree/resources/account.py,sha256=8vnsX-lJi5anPK1LrZwfeiO0THnKAp9UtynyQw29Sbg,3961
|
|
14
|
+
pyolivetree/resources/ai.py,sha256=587HCvOCjHc1OD_YymihIpzIYhmfeWEFCqsf8MSMHAE,1528
|
|
15
|
+
pyolivetree/resources/firebase.py,sha256=PujbJm8sgpXaz8RftkSwEDAQJduGWtcX4uwt6DsLC58,693
|
|
16
|
+
pyolivetree/resources/media.py,sha256=BlOPmBVedKIZUQhGxSzEqE-23JjUYmoCAOYe0lPyA5Y,1668
|
|
17
|
+
pyolivetree/resources/messages.py,sha256=YjNe2bYnIjFqXcOXYILm-_H_iJv-jpotmCeFqNgmI1M,1400
|
|
18
|
+
pyolivetree/resources/products.py,sha256=stlhImANVCeNo_KTUe5nzDwXDH7aYEtJngW01Fv-bEU,1989
|
|
19
|
+
pyolivetree/resources/reading.py,sha256=Cmy1gn92Nz2_lUVR8Su0TKFLLWktUegJOMOBtdHIp3Y,2044
|
|
20
|
+
pyolivetree/resources/store.py,sha256=fK-SPPySXUD-4G6T6nUuu4HnA5rLcpPL87EjSqr4XDw,7126
|
|
21
|
+
pyolivetree/resources/sync.py,sha256=74DRDTtbIwZ96hyWsrS4kl7sBpTBHEKBwKurA3DBOG0,6597
|
|
22
|
+
pyolivetree/resources/telemetry.py,sha256=3PXDi0A3CE3C3AT0mgzkFkHAPRiVjC2QO6Ang10BGMY,2608
|
|
23
|
+
pyolivetree/resources/web.py,sha256=yxci1Xd62YGRsiD11apl0mhSUrKYAN_Tk6K-QEYXEHE,2252
|
|
24
|
+
pyolivetree-2.0.0.dist-info/METADATA,sha256=apynkA2Oj23f6OZGVZ-n8FVOwaiyPW4TykOdb4CnOJg,9014
|
|
25
|
+
pyolivetree-2.0.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
26
|
+
pyolivetree-2.0.0.dist-info/entry_points.txt,sha256=Pvaq9gTQuNOxPeHAs3_mrjIc77fmZJp9zOGXSBlkg3c,53
|
|
27
|
+
pyolivetree-2.0.0.dist-info/licenses/LICENSE,sha256=9heS9i1effcI8SNUPf-C967kg50ouwjyd8kJ72Fz6Oc,1069
|
|
28
|
+
pyolivetree-2.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Taiwo Kareem
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|