Mabibli Python Client
NOT OFFICIALLY SUPPORTED BY THE PROVINCE DE LIÈGE --
An async Python client library for mabibli.be, the library network of the Province of Liège. This client logs in with your library card and reads your account, loans and borrowing history, and can renew loans. Developped for a Home Assistant integration. At least for now.
Installation
You can install the package using pip:
pip install pymabibli
Usage
Here's a basic example of how to use the client:
import asyncio
from pymabibli import MabibliClient
async def main():
async with MabibliClient("your-card-number", "your-password") as client:
# Log in (also done automatically by the other methods)
await client.login()
# Get account information
account = await client.get_account()
print(f"Membership ends: {account.subscription_end}")
# Get current loans
loans = await client.get_loans()
for loan in loans:
print(f"{loan.title} [{loan.library}] due {loan.due_date}")
# Get borrowing history
history = await client.get_history()
print(f"{len(history)} items borrowed")
# Renew one loan
messages = await client.renew_loan(loans[0])
# Renew all loans ("Tout prolonger")
messages = await client.renew_all()
asyncio.run(main())
You can pass your own aiohttp.ClientSession with session=; the client then leaves it open when closing.
The login is kept in the session's cookie jar, so each client needs a session of its own:
two cards sharing one session would see each other's account.
In Home Assistant, use async_create_clientsession(hass) per config entry, not the shared async_get_clientsession(hass).
Error Handling
The client provides specific exception classes:
Exception Classes
MabibliError: Base exception for all errorsMabibliAuthError: Raised when the card number or password is rejectedMabibliConnectionError: Raised when the site can't be reached or returns an unexpected pageMabibliRenewError: Raised when a loan can't be renewed or the site refuses the renewal
Example Error Handling
from pymabibli import MabibliAuthError, MabibliClient, MabibliRenewError
async def renew_everything():
async with MabibliClient("your-card-number", "your-password") as client:
try:
loans = await client.get_loans()
except MabibliAuthError as e:
print(f"Login failed: {e}")
return
for loan in loans:
if not loan.renewable:
continue
try:
await client.renew_loan(loan)
except MabibliRenewError as e:
print(f"Could not renew {loan.title}: {e}")
Authentication
mabibli.be authenticates through a CAS server (centralcas.gminvent.fr).
The client logs in on first use and logs in again when the site's session expires.
Renewals are never retried automatically: if the session is lost during a renewal, MabibliAuthError is raised
and you should check the loan before trying again.
API Methods
login() -> None: Log in with the card number and passwordget_account() -> Account: Get name, card number and membership end dateget_loans() -> list[Loan]: Get current loans, across all pagesget_history() -> list[Loan]: Get previously borrowed items, newest first, across all pagesrenew_loan(loan: Loan) -> list[Message]: Renew one loan and return the site's messagesrenew_all() -> list[Message]: Renew all renewable loans and return the site's messages
Development
pipenv install --dev
pipenv run pytest
pipenv run flake8
The scripts in examples/ run against the real site with your own card.
examples/renew.py really renews a loan, after asking which one.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for pymabibli 0.0.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 |
|---|---|---|---|---|
| pymabibli-0.0.1.tar.gz | 12.9 kB | With provenance | Details for pymabibli-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pymabibli-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for pymabibli-0.0.1-py3-none-any.whl |
Total release size: 23.2 kB
Release files / pymabibli-0.0.1.tar.gz
| Download URL | pymabibli-0.0.1.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b490c5d179bbb9dcad1d826427fd2ab231c413d0a07aba4a4c93e245ae47631e
|
|
BLAKE2b-256 checksum How to use checksums |
014bcfbc46548da597b6612646b0c9a9599a784f5c55fd7a52e14b8c6ec1fbc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 31, 2026.
Transparency logRelease files / pymabibli-0.0.1-py3-none-any.whl
| Download URL | pymabibli-0.0.1-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6efaca6787e6edcd177ccb8b3ddc3836c5517d049249b3b1e07829dc5b0c3fb5
|
|
BLAKE2b-256 checksum How to use checksums |
47fffb0525a5eb8651983f8e64d9ab6230c0cb067bab441e33241579967c5227
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 31, 2026.
Transparency logSecurity for pymabibli 0.0.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for pymabibli-0.0.1.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 Oct 31, 2026.
Transparency logA 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.