pykoreader
Pure-Python model of the KOReader telemetry snapshot and the Home Assistant command protocol: snapshot parsing, command builders, and a coalescing, capped command queue. No Home Assistant or network dependencies.
Used by the ha-koreader Home Assistant integration, but usable standalone.
Install
pip install pykoreader
Usage
from pykoreader import Snapshot, CommandQueue, parse_payload, commands
# Parse an incoming webhook body (a decoded JSON object) into a typed snapshot.
snap = parse_payload({"battery_level": 80, "reading": True, "book_title": "Foundation"})
print(snap.battery_level, snap.book_title) # 80 Foundation
# Build and queue commands for the device's next check-in.
queue = CommandQueue()
queue.add(commands.set_frontlight(40))
queue.add(commands.set_frontlight(60)) # idempotent: replaces the previous one
queue.add(commands.show_message("Time to sleep", timeout=10))
print(queue.drain()) # returns pending commands and clears
API
Snapshot/Snapshot.from_payload(mapping)— typed telemetry fields; unknown keys kept in.extra.parse_payload(raw)— validate a decoded body is an object and return aSnapshot(raisesValueErrorotherwise).commands— builders:set_frontlight,set_warmth,set_frontlight_power,set_wifi,page_turn,goto_page,goto_chapter,toggle_bookmark,set_dark_mode,suspend,restart,refresh,sync_now,show_message; plus type constants andCOALESCE_TYPES.CommandQueue—add(command),drain(),pending,len(). Coalesces idempotent types (last-write-wins), caps atMAX_QUEUED_COMMANDS.
License
MIT
Metadata
Release files for pykoreader 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pykoreader-0.2.0.tar.gz | 6.8 kB | With provenance | Details for pykoreader-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pykoreader-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pykoreader-0.2.0-py3-none-any.whl |
Total release size: 13.3 kB
Release files / pykoreader-0.2.0.tar.gz
| Download URL | pykoreader-0.2.0.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a54afb128d211673f93e431a5289a6b36fab5d51ebece29180a208c3179b4b8
|
|
BLAKE2b-256 checksum How to use checksums |
f0a7b176a55ba1f5dbb950b1ce7a99d739ea351fbc55e4428b55e79eb335d7f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 28, 2026.
Transparency logRelease files / pykoreader-0.2.0-py3-none-any.whl
| Download URL | pykoreader-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38c34d60e1f92abc795e896ca282721a487bb8f2cd7ea15deeebffedad7b14c6
|
|
BLAKE2b-256 checksum How to use checksums |
f4dee8236a7f518824010094a779d18b7ce54b42ac0e783790e96431cf7fe021
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 28, 2026.
Transparency logSecurity for pykoreader 0.2.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pykoreader-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 28, 2026.
Transparency logA 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.