Send To Kindle
stkclient implements a client for amazon’s “Send to Kindle” service. It allows python programs to send files to a kindle device without the 10mb limit that applies to email files.
Features
OAuth-based authorization
Send large (>10MB) files to Kindle devices
Installation
Python 3.11 or later is required. You can install Send To Kindle via pip from PyPI:
$ pip install stkclient
Creating a Client
To create a client, you must authenticate the user. Currently the only supported authentication mechanism is OAuth2:
import stkclient
a = stkclient.OAuth2()
signin_url = a.get_signin_url()
# Open `signin_url` in a browser, sign in and authorize the application, pass
# the final redirect_url below
client = a.create_client(redirect_url)
Once a client is created, it can be serialized and deserialized using Client.load / Client.loads and client.dump / client.dumps
with open('client.json', 'w') as f:
client.dump(f)
with open('client.json', 'r') as f:
client = stkclient.Client.load(f)
Sending a File
Once you have a Client object, you can list devices and send files to specified devices.
devices = client.get_owned_devices()
destinations = [d.device_serial_number for d in devices]
client.send_file(filepath, destinations, author=author, title=title, format="epub")
The format argument describes the input file. PDFs are delivered with their original page layout by default. To convert a PDF to Kindle format, set force_convert=True:
client.send_file(
filepath, destinations, author=author, title=title,
format="pdf", force_convert=True,
)
Development
Install the CI tools with Python 3.12, then run the same Nox sessions as CI:
$ python3.12 -m pip install -c .github/workflows/constraints.txt poetry poetry-plugin-export nox nox-poetry
$ nox -s tests-3.12 mypy typeguard xdoctest docs-build pre-commit audit
CI tests Python 3.11 through 3.15 and runs the newest version on Linux, macOS, and Windows. The minimum Python version follows the Python support schedule. Maintenance tools run on Python 3.12. The audit session checks locked runtime, test, and development dependencies against the PyPI vulnerability database. The documentation build treats warnings as errors. Pull requests also build the release distributions; publishing remains limited to pushes to the main branch.
License
Distributed under the terms of the MIT license, Send To Kindle is free and open source software.
Credits
Project structure from @cjolowicz’s Hypermodern Python Cookiecutter template.
Metadata
Release files for stkclient 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 | |
|---|---|---|---|
| stkclient-0.2.0.tar.gz | 13.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stkclient-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.1 kB
Release files / stkclient-0.2.0.tar.gz
| Download URL | stkclient-0.2.0.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
84ce50b24fe3ea024fb9c4bcd67276a7762d7c1eaf1e1214ddfac17702e6e175
|
|
BLAKE2b-256 checksum How to use checksums |
b4501d1d5d1f0bc16d6f423b56ccc83743e0366850b8b981593cd6d19ec995ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / stkclient-0.2.0-py3-none-any.whl
| Download URL | stkclient-0.2.0-py3-none-any.whl |
|---|---|
| Size | 14.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
162f044c43f32899eb1f66c0ddbec37a76db0e1a6cf79368c04f62be854e297f
|
|
BLAKE2b-256 checksum How to use checksums |
47a2061decd161d38dd2bf910feeadaba936c6b4537c4cb908980756c5762d68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|