Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Reason given by maintainers: unreleased

PyLibrus

PyPI version Python versions License: MIT

Librus (polish school e-register) unofficial async API client written in Python.

Features

  • ✨ Async/await support - Built with httpx for modern async Python
  • 🔐 OAuth authentication with token refresh
  • 📚 Access to all Librus API resources
  • 🧪 Comprehensive test suite
  • 🔄 GitHub Actions CI/CD
  • 📦 Dependabot integration

Installation

pip install pylibrus

Usage

(Replace every field containing 'your' with your data)

Authorization

  • Authorize using existing token (load existing tokens pair)
    or
  • Generate new OAuth token
    • using user credentials:
      import asyncio
      import pylibrus
      
      async def main():
          access_token, refresh_token = await pylibrus.auth.user_credentials(
              username="yourusername",
              password="yourpassword",
              long_lived=True  # optional, if set to True (default) token will be valid for 24h
          )
          print(
              access_token,  # used to access resources
              refresh_token  # used to regenerate access token without user credentials
          )
      
      asyncio.run(main())
      
    • using previously generated refresh token:
      import asyncio
      import pylibrus
      
      async def main():
          access_token, refresh_token = await pylibrus.auth.refresh_token(
              refresh_token="yourrefreshtoken",
              long_lived=True  # default True (if not specified)
          )
          print(access_token, refresh_token)
      
      asyncio.run(main())
      

Accessing resources

Access resources using previously generated access token (see Authorization):

import asyncio
import pylibrus

async def main():
    async with pylibrus.Librus("youraccesstoken") as lib:
        json_res = await lib.getResource("YourResourceName")
        print(json_res)  # Raw API response (decoded JSON as dict)

asyncio.run(main())

List of available resources here.

Examples

Get user name using login/password authorization:

import asyncio
import pylibrus

async def main():
    access_token, _ = await pylibrus.auth.user_credentials(
        username="yourusername",
        password="yourpassword",
    )
    async with pylibrus.Librus(access_token) as lib:
        names = (await lib.getResource("Me"))["Me"]["User"]
        print(f"Hello {names['FirstName']} {names['LastName']}")

asyncio.run(main())

Get number of user's grades using new access token generated using previously cached refresh token:

import asyncio
import pylibrus

async def main():
    access_token, _ = await pylibrus.auth.refresh_token(
        refresh_token="yourrefreshtoken"
    )
    async with pylibrus.Librus(access_token) as lib:
        grades = (await lib.getResource("Grades"))["Grades"]
        print(len(grades))

asyncio.run(main())

Development

You can set up a development environment like this:

git clone https://github.com/YOU/YOUR_FORK.git .
python3 -m venv venv
source venv/bin/activate
pip install -e ".[dev]"

Run tests:

pytest

Run linting:

ruff check .
mypy pylibrus

Contribute

We welcome contributions! Here's how to get started:

Making Changes

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests and linting:
    pytest
    ruff check .
    mypy pylibrus
    
  5. Commit your changes with descriptive messages
  6. Push to your fork and open a Pull Request
  7. Add appropriate labels to your PR:
    • feature - New features or enhancements
    • bug - Bug fixes
    • documentation - Documentation updates
    • chore - Maintenance tasks
    • breaking - Breaking changes

Release Process

This project uses automated releases via GitHub Actions:

  1. Update version in setup.py
  2. Update CHANGELOG.md (or it will be auto-generated from PRs)
  3. Commit changes:
    git add setup.py CHANGELOG.md
    git commit -m "Bump version to X.Y.Z"
    
  4. Create and push tag:
    git tag vX.Y.Z
    git push origin main --tags
    
  5. Automated workflow will:
    • Run tests and linting
    • Build the package
    • Publish to PyPI
    • Create GitHub release with changelog

For more details, see docs/RELEASE.md.

Questions or Issues?

Feel free to open an issue on GitHub!

Metadata

Release files for pylibrus 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 pylibrus 0.1.0
File Size Uploaded
pylibrus-0.1.0.tar.gz 6.4 kB Details

Built distribution (wheel)

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

Total release size: 13.6 kB

Release files / pylibrus-0.1.0.tar.gz

Download URL pylibrus-0.1.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f5e7c9a4a5f41d4ca02474979b9bd94ceb09265e5ee87120e31291aa0612c56c
BLAKE2b-256 checksum
How to use checksums
6bbf59efb810ce04bbfb1dd7b85057c335bee134baf98b1019841938ab9e82ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jan 28, 2026.

Transparency log

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

Download URL pylibrus-0.1.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
750933605b5ba5dc5ac3e4a3b6d7ab34a0c18ba54a3e324f39e210f71b5cf3b4
BLAKE2b-256 checksum
How to use checksums
52db9c71cd458a9b18ab6589a2c4750cc7a12ea5887dd01bfd47b61f4b304641
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jan 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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