OPDS python library
This package allows you to easily compose an OPDS version 1.2 catalog.
No reason to touch any xml yourself, everything is wrapped in semantic Python classes.
Installation
Install from PyPI
pip install opds
Note
This package will remain functional and safe without regular updates.
This package has NO dependencies. Also OPDS1.2 is a stable standardized format.
Therefore the only activity on this repo will be features and fixes. If there is low or no activity that does not indicate security or usability deficits.
Usage
First of all check out the the official OPDS catalog spec documentation.
It has a lot of useful and instructive examples that will help you understand what to add to your catalog.
A single OPDS catalog file is represented by the OPDSCatalog class
opds_catalog = opds.OPDSCatalog(title="Example")
The catalog comes with all required metadata configured by initialization. It is stored in the metadata member, you can use all methods of the list container to add more.
For example
summary = opds.Metadata(name="summary", value="An example OPDS catalog")
opds_catalog.metadata.append(summary)
Every catalog comes with 3 default namespaces: Atom (default), DublinCore (dc) and OPDS (opds). Add more by adding them to the attributes of the OPDSCatalog. You typically won't need to.
As special type of metadata one typically wants to add links for navigation to other catalogs of the same server. For quality of life there are Link subclasses for the most common link types.
other_catalog_link = opds.AcquisitionFeedLink(href="/other-catalog", rel=Link.Rel.SUBSECTION)
self_link = opds.NavigationFeedLink(href="/this-url", role=Link.Rel.SELF)
start_link = opds.NavigationFeedLink(href="/root-url", role=Link.Rel.START)
opds_catalog.links.extend([ other_catalog_link, self_link, start_link ])
The difference between navigation and acquisition feeds is explained in the OPDS spec.
After all metadata is defined, we add the entries to the catalog.
entry_1 = opds.Entry(title="Book 1", uid="book_1")
opds_catalog.entries.append(summary)
Entries hold metadata and links just like the catalog. Adding and manipulating them is completely analogous.
After everything is set up, write the catalog to xml bytes
opds_bytes = opds_catalog.write()
Done.
Disclaimer
There was no AI used in creating this package. Every single line was typed by human hand.
The source code was originally created for the Cata-Log project and later externalized for use across other projects.
License
This software is proudly released under the GNU Affero General Public License v3.0 or later (AGPLv3) open-source license.
Any contributions will be subject to the same licensing.
Metadata
Release files for opds 0.1.3
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 |
|---|---|---|---|---|
| opds-0.1.3.tar.gz | 14.7 kB | Without provenance | Details for opds-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| opds-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for opds-0.1.3-py3-none-any.whl |
Total release size: 29.9 kB
Release files / opds-0.1.3.tar.gz
| Download URL | opds-0.1.3.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f2913148c89b394c258ae84dc93624c816744ef127925be1db9304c28a05f9e
|
|
BLAKE2b-256 checksum How to use checksums |
9871eae2c55941e6e845273abc7f15e58ec92a661d264e7065bc2439139d5c69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.13.14 Linux/5.15.154+
|
Release files / opds-0.1.3-py3-none-any.whl
| Download URL | opds-0.1.3-py3-none-any.whl |
|---|---|
| Size | 15.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
79c1a56572bea34c71cdfb34188d5b549891ea30ccba12c3d71113afa7896416
|
|
BLAKE2b-256 checksum How to use checksums |
ec427afd964becaef355ff82082c70b167f6a1e4ef03cc8466c422385e06e415
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.13.14 Linux/5.15.154+
|
Security for opds 0.1.3
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.