Readeck Python Client
A Python client library for the Readeck API, providing easy access to Readeck's bookmark and reading features.
Features
- Full async/await support
- Type hints with Pydantic models
- Comprehensive error handling
- Support for Python 3.10+
- Easy authentication with Bearer tokens
Installation
pip install readeck
Quick Start
import asyncio
from readeck import ReadeckClient
async def main():
client = ReadeckClient(
base_url="https://your-readeck-instance.com",
token="your-bearer-token"
)
# Get user profile
profile = await client.get_user_profile()
print(f"Welcome, {profile.user.username}!")
# Create a bookmark
result = await client.create_bookmark(
url="https://example.com/article",
title="Interesting Article",
labels=["reading", "tech"]
)
print(f"Bookmark created with ID: {result.bookmark_id}")
await client.close()
if __name__ == "__main__":
asyncio.run(main())
Authentication
The client uses Bearer token authentication. You can obtain your token from your Readeck instance's settings.
client = ReadeckClient(
base_url="https://your-readeck-instance.com",
token="your-bearer-token"
)
API Reference
User Profile
Get the current user's profile information:
profile = await client.get_user_profile()
Returns a UserProfile object containing:
- User information (username, email, creation date)
- Authentication provider details
- User settings and preferences
- Reader settings (font, font size, line height)
Bookmarks
Create Bookmark
Create a new bookmark:
# Minimal bookmark
result = await client.create_bookmark(url="https://example.com")
# Bookmark with title
result = await client.create_bookmark(
url="https://example.com/article",
title="Article Title"
)
# Bookmark with labels
result = await client.create_bookmark(
url="https://example.com/tutorial",
labels=["tutorial", "programming"]
)
# Complete bookmark
result = await client.create_bookmark(
url="https://example.com/complete",
title="Complete Example",
labels=["example", "complete", "demo"]
)
The create_bookmark method returns a BookmarkCreateResult object containing:
response: The API response with message and statusbookmark_id: The ID of the created bookmark (from response headers)location: The URL of the created resource (from response headers)
Get Bookmarks
Retrieve bookmarks with optional filtering:
# Get all bookmarks
bookmarks = await client.get_bookmarks()
# Get bookmarks with parameters
from readeck import BookmarkListParams
params = BookmarkListParams(
limit=10,
search="python",
labels="programming"
)
bookmarks = await client.get_bookmarks(params)
Export Bookmarks
Export bookmarks in different formats:
bookmark_id = "some_bookmark_id"
# Export as markdown (default format)
markdown_content = await client.export_bookmark(bookmark_id)
# Export as markdown explicitly
markdown_content = await client.export_bookmark(bookmark_id, format="md")
# Export as EPUB
epub_content = await client.export_bookmark(bookmark_id, format="epub")
# Save to files
with open("article.md", "w", encoding="utf-8") as f:
f.write(markdown_content)
with open("article.epub", "wb") as f:
f.write(epub_content)
Supported export formats:
md(markdown) - Returns a string with the article content as markdownepub- Returns bytes containing the EPUB file data
Development
This project uses uv for dependency management:
# Install dependencies
uv sync --dev
# Run tests
uv run pytest
# Run integration tests (requires Docker)
uv run pytest tests/integration
# Run linting and formatting
uv run ruff check src tests --fix
uv run ruff format src tests
uv run mypy src
# Run all checks
uv run pre-commit run --all-files
License
MIT License. See LICENSE for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Metadata
Release files for readeck 0.3.1
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 |
|---|---|---|---|---|
| readeck-0.3.1.tar.gz | 16.9 kB | Without provenance | Details for readeck-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| readeck-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for readeck-0.3.1-py3-none-any.whl |
Total release size: 32.9 kB
Release files / readeck-0.3.1.tar.gz
| Download URL | readeck-0.3.1.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33045e8c9cdba35b95bdffd38f4629eeb66b9071742509731928438bf25a3bdf
|
|
BLAKE2b-256 checksum How to use checksums |
78f175a433a27722a43b6a8a8c6361f94d0b91eab1debb395bbb0ab9f7595e34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / readeck-0.3.1-py3-none-any.whl
| Download URL | readeck-0.3.1-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ae59c2c3ee44daa03e012e27b3930a443d2a89ea024d74237aa3dc7f85703a4
|
|
BLAKE2b-256 checksum How to use checksums |
e5904273425cfa0e0697b21d45484f1ac5a14ea16b6012254d323089d1b254a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for readeck 0.3.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.