A Python library for working with OPDS catalogs, supporting both OPDS 1.2 (Atom/XML) and OPDS 2.0 (JSON) specifications.
Features · Installation · Quick Start · Authentication · Models · Usage Examples · OPDS 1.2 vs OPDS 2.0 · Testing · Documentation · Project Structure · License
- ✅ Parse OPDS 2.0 feeds and publications
- ✅ Validate against OPDS 2.0 specification
- ✅ Navigate navigation, publications, groups, and facets collections
- ✅ Handle pagination (first, previous, next, last links)
- ✅ Search catalogs with URI template resolution
- ✅ Work with acquisition links (download, buy, borrow, etc.)
- ✅ HTTP error handling with retries
- ✅ Pydantic models for type safety
- ✅ Parse OPDS 1.2 Atom feeds and entries
- ✅ Dublin Core metadata support
- ✅ Navigation and Acquisition feeds
- ✅ Facet groups with active facets and item counts
- ✅ Acquisition links with prices and indirect acquisitions
- ✅ OpenSearch integration
- ✅ Multiple acquisition relations (buy, borrow, subscribe, etc.)
pip install opds-clientfrom opds_client import OPDS2Client
# Create a client
client = OPDS2Client()
# Fetch a feed
feed = client.fetch_feed("https://example.com/opds")
# Access feed metadata
print(f"Title: {feed.metadata.title}")
print(f"Publications: {len(feed.publications or [])}")
# Navigate navigation links
for nav in feed.navigation or []:
print(f"- {nav.title}: {nav.href}")
# Search
results = client.search(feed, "query")from opds_client import OPDS12Client
# Create a client for OPDS 1.2
client = OPDS12Client()
# Fetch a feed (XML format)
feed = client.fetch_feed("https://example.com/opds.xml")
# Access feed metadata
print(f"Title: {feed.title}")
print(f"Entries: {len(feed.entries or [])}")
# Navigate navigation links
start_link = feed.get_start_link()
# Get acquisition links from entries
if feed.entries:
entry = feed.entries[0]
acq_links = entry.get_acquisition_links()The full documentation is available at: https://sevdani.github.io/opds-client
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run with coverage
pytest --cov=opds_client
# Run type checks
mypy opds_client
# Run linter
ruff check .# Install docs dependencies
pip install -e ".[docs]"
# Build with Zensical
zensical build
# Preview with Zensical
zensical serveMIT License - see LICENSE file for details.