Skip to main content

omnis-py

Biblioteka Python do obsługi API Ex Libris Primo (sieć OMNIS) oraz narzędzie CLI do zarządzania kontami bibliotecznymi.


Opis (PL)

omnis-py to biblioteka umożliwiająca programistyczny dostęp do kont czytelnika w bibliotekach korzystających z systemu Ex Libris Primo (w Polsce działających głównie w ramach sieci OMNIS).

Główne funkcjonalności

  • Autentykacja: Logowanie do systemów bibliotecznych przy użyciu numeru karty i hasła.
  • Wypożyczenia: Pobieranie listy aktywnych wypożyczeń wraz ze szczegółami (data zwrotu, autor, tytuł, filia).
  • Informacje o użytkowniku: Pobieranie stanu konta, liczby wypożyczeń, rezerwacji oraz naliczonych kar.
  • Prolongata: Możliwość przedłużania terminu zwrotu książek.
  • Narzędzie CLI: Wygodna aplikacja terminalowa do monitorowania wielu kont na raz.

Obsługiwane biblioteki (znane tenany)

Biblioteka jest uniwersalna i obsługuje m.in.:

  • Biblioteka Raczyńskich (Poznań)
  • Biblioteka Narodowa (Warszawa)
  • Biblioteka UAM (Poznań)
  • Dolnośląska Biblioteka Publiczna (Wrocław)
  • Uniwersytet Jagielloński (Kraków)
  • Uniwersytet Mikołaja Kopernika (Toruń)
  • Wojewódzka Biblioteka Publiczna (Kielce)
  • Koszalińska Biblioteka Publiczna
  • Książnica Zamojska
  • ...oraz każdą inną bibliotekę Primo po podaniu jej adresu URL i kodu instytucji.
  • Nieoficjalna Biblioteka OMNIS (Demo) — publiczny mock serwera Primo (omnis-mock) z gotowym kontem testowym, bez potrzeby posiadania prawdziwej karty bibliotecznej. Zobacz --demo poniżej.

Instalacja

pip install omnis-py

Dla narzędzia CLI zalecane jest użycie pipx:

pipx install omnis-py

Użycie CLI

Po instalacji dostępne jest polecenie omnis-cli.

Przy pierwszym uruchomieniu program poprowadzi Cię przez kreator dodawania konta. Konfiguracja jest przechowywana w ~/.config/omnis-py/config.yaml.

  • omnis-cli - wyświetla podsumowanie dla wszystkich kont i listę książek pogrupowaną według filii.
  • omnis-cli --add - dodaje nowe konto do konfiguracji.
  • omnis-cli --renew - próbuje przedłużyć wszystkie wypożyczenia oznaczone jako odnawialne dla skonfigurowanych kont przed pobraniem danych. Używaj ostrożnie; operacja wykona się bez dodatkowego potwierdzenia.
  • omnis-cli --search "tytuł lub fragment" - wyszukuje książki w katalogu (na koncie pierwszej skonfigurowanej biblioteki), grupując wyniki wg tytułu i pokazując wszystkie wydania/wersje osobno wraz ze statusem dostępności w poszczególnych filiach (dostępna / wypożyczona do dnia).
  • omnis-cli --search "..." --branch "nazwa filii" - jak wyżej, ale ogranicza wyniki do filii, których nazwa zawiera podany fragment (bez rozróżniania wielkości liter).
  • omnis-cli --series "nazwa serii" / omnis-cli --author "Nazwisko, Imię" - wyszukiwanie po serii lub autorze (zamiast --search; tylko jedno z trzech naraz). Na liście zostają wyłącznie wydania danej serii/autora — Primo łączy w jedno dzieło różne książki o tym samym tytule (np. „Nowa kolekcja bajek”), więc wydania innych serii są odfiltrowywane.
  • omnis-cli --author "..." --include-unmatched (także z --series) - pokazuje również dzieła, które Primo trafił luźno, ale nie pasują do autora/serii (np. inna osoba o podobnym nazwisku albo błąd w katalogu). Domyślnie są ukrywane, a CLI wypisuje ich tytuły i liczbę. Gdy nic nie pasuje, nic nie jest ukrywane.
  • omnis-cli --branches - pokazuje katalog filii Biblioteki Raczyńskich (adres, godziny otwarcia, telefon, link do Google Maps). Nie wymaga skonfigurowanego konta - dane pochodzą bezpośrednio ze strony bracz.edu.pl. Działa wyłącznie dla Biblioteki Raczyńskich.
  • omnis-cli --branches --branch "Filia 35" - jak wyżej, ograniczone do filii, których nazwa zawiera podany fragment.
  • omnis-cli --list-accounts - wyświetla skonfigurowane konta z numerem (indeksem), biblioteką, nazwą użytkownika, statusem włączenia i timeoutem.
  • omnis-cli --enable N / omnis-cli --disable N - włącza/wyłącza konto o podanym numerze indeksu (z --list-accounts), bez usuwania go z konfiguracji.
  • omnis-cli --set-timeout N SEKUNDY - ustawia niestandardowy timeout HTTP (w sekundach) dla konta o podanym indeksie.
  • omnis-cli --demo - przełącza się w tryb demo: wyłącza wszystkie skonfigurowane konta prawdziwych bibliotek i włącza (lub dodaje, jeśli jeszcze nie istnieje) konto testowe wskazujące na omnis-mock — publiczny, samowystarczalny mock API Primo z fikcyjnymi wypożyczeniami. Wygodne do wypróbowania narzędzia bez podawania prawdziwych danych logowania. Pierwsze zapytanie może potrwać do ok. 50 sekund, jeśli darmowa instancja mocka na Render "obudziła się" po dłuższej bezczynności.
  • omnis-cli --exit-demo - wychodzi z trybu demo: wyłącza konto testowe i przywraca (włącza z powrotem) konta, które zostały automatycznie wyłączone przez --demo.

Przykład wyszukiwania krok po kroku (cały cykl książek, z priorytetem konkretnych filii): docs/examples/plomien-i-krzyz.md.


Description (EN)

omnis-py is a Python library providing programmatic access to patron accounts in libraries using the Ex Libris Primo system (widely used in Poland under the OMNIS network).

Key Features

  • Authentication: Login using card number and password.
  • Loans: Fetch active loans with details (due date, author, title, branch).
  • User Info: Get account status, number of loans, requests, and fines.
  • Renewal: Support for renewing book loan terms.
  • CLI Tool: A convenient terminal application to monitor multiple accounts at once.

Supported Libraries

The library is generic and supports various institutions including:

  • Raczyński Library (Poznań)
  • National Library of Poland (Warszawa)
  • Adam Mickiewicz University Library (Poznań)
  • Lower Silesian Public Library (Wrocław)
  • Jagiellonian University (Kraków)
  • Nicolaus Copernicus University (Toruń)
  • ...and any other Primo library by providing its URL and institution code.
  • Nieoficjalna Biblioteka OMNIS (Demo) — a public mock Primo server (omnis-mock) with a ready-made test account, no real library card needed. See --demo below.

Installation

pip install omnis-py

For the CLI tool, using pipx is recommended:

pipx install omnis-py

CLI Usage

Once installed, the omnis-cli command becomes available.

On first run, it will guide you through adding an account. Configuration is stored in ~/.config/omnis-py/config.yaml.

  • omnis-cli - shows a summary for all accounts and a book list grouped by branch.
  • omnis-cli --add - adds a new account to the configuration.
  • omnis-cli --renew - attempts to renew all loans marked as renewable for configured accounts before fetching data. Use with caution; this action runs without an additional confirmation.
  • omnis-cli --search "title or keyword" - searches the catalog (using the first configured account), grouping results by title and showing every edition/version separately along with per-branch availability (available / borrowed until date).
  • omnis-cli --search "..." --branch "branch name" - as above, but limited to branches whose name contains the given text (case-insensitive).
  • omnis-cli --series "series name" / omnis-cli --author "Surname, Name" - search by series or author instead of --search (only one of the three at a time). Only editions that really belong to that series/author are listed: Primo groups different books with the same title (e.g. "Nowa kolekcja bajek") into one work, so editions of other series are filtered out.
  • omnis-cli --author "..." --include-unmatched (also with --series) - also lists works Primo hit loosely that do not match the author/series (e.g. a different person with a similar name, or a catalogue error). They are hidden by default, and the CLI prints their titles and count. If nothing matches, nothing is hidden.
  • omnis-cli --branches - shows the Biblioteka Raczyńskich branch directory (address, opening hours, phone, Google Maps link). No account required - data comes directly from bracz.edu.pl. Works for Biblioteka Raczyńskich only.
  • omnis-cli --branches --branch "Filia 35" - as above, limited to branches whose name contains the given text.
  • omnis-cli --list-accounts - lists configured accounts with their index, library, username, enabled status, and timeout.
  • omnis-cli --enable N / omnis-cli --disable N - enables/disables the account at the given index (from --list-accounts), without removing it from the configuration.
  • omnis-cli --set-timeout N SECONDS - sets a custom HTTP timeout (in seconds) for the account at the given index.
  • omnis-cli --demo - switches to demo mode: disables all configured real-library accounts and enables (or creates, if it doesn't exist yet) a demo account pointing at omnis-mock — a public, self-contained mock of the Primo API with fake loans. Handy for trying out the tool without real login credentials. The first request may take up to ~50 seconds if the free-tier mock instance on Render needs to wake up from being idle.
  • omnis-cli --exit-demo - exits demo mode: disables the demo account and restores (re-enables) the accounts that --demo had automatically disabled.

Home Assistant

Istnieje również integracja dla Home Assistant korzystająca z tej biblioteki: omnis-ha.

There is also a Home Assistant integration using this library: omnis-ha.

License

MIT

Metadata

Release files for omnis-py 0.3.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 omnis-py 0.3.0
File Size Uploaded Provenance Actions
omnis_py-0.3.0.tar.gz 63.5 kB With provenance Details for omnis_py-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for omnis-py 0.3.0
File Interpreter ABI Platform Actions
omnis_py-0.3.0-py3-none-any.whl Python 3 none any Details for omnis_py-0.3.0-py3-none-any.whl

Total release size: 101.2 kB

Release files / omnis_py-0.3.0.tar.gz

Download URL omnis_py-0.3.0.tar.gz
Size 63.5 kB
Tags Source
SHA-256 checksum
How to use checksums
73d18e57df66e95e9759c26a6e2ec89e550f0cee38adda4c132159f08753a750
BLAKE2b-256 checksum
How to use checksums
3778a8ed6ff2a70bd05281ea6fd046e06b8c659209987e8e4e6a24d95868e878
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 Nov 14, 2026.

Transparency log

Release files / omnis_py-0.3.0-py3-none-any.whl

Download URL omnis_py-0.3.0-py3-none-any.whl
Size 37.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fada45ea027435f9e926421d77a26e37164cc63273a94de80c683538971beca4
BLAKE2b-256 checksum
How to use checksums
b7176521d6f1c262b39e9d89d6e0f070d3ba310ef96bcde3d6e01612244e254e
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 Nov 14, 2026.

Transparency log

Security for omnis-py 0.3.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 omnis_py-0.3.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 14, 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