Skip to main content

biblo

An unofficial Python client and command line for Biblo, the Danish public libraries' app for e-books, audiobooks and podcasts (by Det Digitale Folkebibliotek).

Search the catalogue, borrow and renew, reserve, and keep track of your loans: from Python (sync or async) or from the terminal.

$ biblo auth login --library vejle
Card number or CPR: 0102031234
Pincode:
✓ Logged in to Vejle Bibliotekerne (763000) as Test Testesen

$ biblo search "tove ditlevsen" --audiobook
$ biblo work work-of:870970-basis:143298507
$ biblo borrow 870970-basis:143304299
$ biblo loans
Title                          By               Format           Due                         Loan id
Barndommens gade               Tove Ditlevsen   lydbog (online)  2026-12-20 (in 30 days)     123456

Not affiliated with Det Digitale Folkebibliotek or the libraries. It talks to the same API as the Android app, with your own library login. Reading and listening still happen in the Biblo app: books are DRM-protected and this project does not download them.

Install

pip install 'biblo[cli]'      # library + the biblo command
pip install biblo             # just the library
uvx --from 'biblo[cli]' biblo search "harry potter" -l vejle   # try it without installing

Python 3.12 or newer.

Command line

Everything a library belongs to takes --library/-l with an id or (part of) a name: -l vejle, -l 763000, or set BIBLO_LIBRARY. Once you've logged in, your own library is the default.

Command
biblo libraries [town] find your library's id
biblo auth login / status / logout / token your session
biblo search QUERY --ebook, --audiobook, --podcast, --language dan, --by title, -f subjects=krimi
biblo work WORK_ID description, availability and the records (editions) to borrow
biblo borrow RECORD_ID borrow an e-book, audiobook or podcast
biblo loans / biblo renew [--all] your loans
biblo reservations / reserve / cancel reservations
biblo favorites [add|remove] your saved works
biblo account / messages details, digital quota left, fees, messages
biblo branches / hours / events the physical library
biblo api PATH call any endpoint, like gh api

Every listing takes --json for scripts, e.g. biblo loans --json | jq '.[].due_date'.

Logging in. biblo auth login asks for your card number or CPR and pincode and logs in at login.bib.dk the way the app does. For scripts, pass --user (or BIBLO_USER) and the pincode in BIBLO_PIN or on stdin with --pin-stdin. The pincode is never stored; the session's tokens are, in ~/.config/biblo/session.json (readable only by you; override the folder with BIBLO_CONFIG_DIR). For MitID, use biblo auth login --web.

Exit codes: 0 ok, 1 error, 2 bad usage, 4 not logged in.

Python

from biblo import Biblo, FileTokenStorage

with Biblo("763000", storage=FileTokenStorage("session.json")) as biblo:
    result = biblo.catalog.search("harry potter", material_types_specific="e-bog")
    print(result.hitcount)
    work = biblo.catalog.work(result.works[0].id)
    ebook = next(r for r in work.variations if r.material_type.display == "e-bog")

    biblo.login("0102031234", "1234")          # once; the session is saved
    loan = biblo.loans.borrow(ebook.record_id)
    for loan in biblo.loans.list():
        print(loan.record.title, loan.due_date)

AsyncBiblo is the same client for asyncio:

from biblo import AsyncBiblo

async with AsyncBiblo("763000") as biblo:
    async for work in biblo.catalog.iter_search("krimi", max_results=200):
        print(work.title)

The client groups the API:

catalog search, iter_search, facets, suggest, work, availability, record, records_status, holdings, series, recommendations, reviews, sample
loans list, borrow, renew, borrow_physical, return_physical
reservations list, create, update, cancel, convert
account get, update, quotas, fees, change_pincode
favorites, messages, devices the user's saved works, messages and push tokens
libraries list, find, get, configuration, branches, opening_hours, open_status, events
content the app's editorial front page

biblo.request(method, path) reaches anything else.

Results are typed Pydantic models generated from the API's own OpenAPI spec, with snake_case fields (loan.due_date, a timezone-aware datetime). Fields and enum values the spec doesn't know yet are kept rather than rejected, and if the API sends something its spec doesn't allow (it sometimes sends null for a promised string), that one value is passed through as sent and logged at DEBUG on the biblo logger instead of failing the whole call.

Libraries. Calls default to the library given to the client; account calls default to the library you logged in at. Every method also takes library_id=.

Sessions. Give the client a storage and it saves the tokens after login and every refresh: FileTokenStorage, MemoryTokenStorage, or your own TokenStorage (AsyncTokenStorage for AsyncBiblo) with load() and save(). Access tokens are refreshed before they expire and once more if the API answers 401.

Home Assistant and other frameworks. Pass your own httpx client with http_client= (the client then leaves closing it to you) and a AsyncTokenStorage backed by the framework's storage.

Errors all derive from biblo.BibloError: InvalidCredentialsError for a refused login, NotLoggedInError when a session is missing or can no longer be refreshed, BibloConnectionError, and APIError subclasses by status (NotFoundError, ConflictError, RateLimitError, ...) carrying the API's code, type and message.

How it works

The app's backend, https://api.detdigitalefolkebibliotek.dk, publishes its OpenAPI spec (the root URL is a Swagger UI). It serves three apps: Biblo, Mit Biblo (the physical library: branches, events, Scan & Loan) and Biblo Go, and some endpoints only answer one of them; the client sends the right x-app-type for each. The API key, app version and login.bib.dk OAuth client are the ones every copy of the Android app ships (src/biblo/_constants.py).

Logging in goes through login.bib.dk (Adgangsplatformen): its library-card form is posted, the biblo://?code=... redirect is caught, and the code is exchanged at /v1/auth/login.

Development

uv sync
uv run python scripts/check.py           # everything CI runs
uv run pytest -m live                    # read-only checks against the real API

The models (src/biblo/models/_generated.py), the app-type table and the whole sync client (src/biblo/_sync/) are generated: edit src/biblo/_async/ or spec/, then run uv run python scripts/generate.py. See AGENTS.md for the details.

Releasing: uv run python scripts/release.py X.Y.Z bumps the version, commits, pushes and creates the GitHub release; publishing the release uploads it to PyPI.

License

MIT

Metadata

Release files for biblo 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for biblo 0.1.0
File Size Uploaded Provenance Actions
biblo-0.1.0.tar.gz 48.9 kB With provenance Details for biblo-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for biblo 0.1.0
File Interpreter ABI Platform Actions
biblo-0.1.0-py3-none-any.whl Python 3 none any Details for biblo-0.1.0-py3-none-any.whl

Total release size: 106.2 kB

Release files / biblo-0.1.0.tar.gz

Download URL biblo-0.1.0.tar.gz
Size 48.9 kB
Tags Source
SHA-256 checksum
How to use checksums
805145e7ee55f86ef3485b4e165ae949912d0b76682d9b5314ce5f0eb69826ce
BLAKE2b-256 checksum
How to use checksums
babb01e286929fbb3602ae31ca900526f243352256917d9f875f0cb790ff6acf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Nov 20, 2026.

Transparency log

Release files / biblo-0.1.0-py3-none-any.whl

Download URL biblo-0.1.0-py3-none-any.whl
Size 57.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1061e41176b97d3ad2c94ba411ac96f6e0efde0d1c18d5865e965393cdafcfa3
BLAKE2b-256 checksum
How to use checksums
280ae4e3cd6b0ece2410dc4c1dc7ab82b2841658245b930e9e45758a92f7a79e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Nov 20, 2026.

Transparency log

Security for biblo 0.1.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.

Select from 2 files

Attestation for biblo-0.1.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 Nov 20, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page