Skip to main content

LANiS (Schulportal Hessen) API

Python License PyPI version

Unofficial Python client and REST API integrations for Schulportal Hessen (SPH). The PyPI package contains the reusable Python client; the repository also includes the optional hosted API server and a terminal UI.

The client is actively developed against the portal's web interfaces. Portal changes can occasionally require a new package release.

Live Server

The hosted API is available at lanis-backend.joancode.dev, with interactive documentation at /documentation. image

Components

This monorepo contains the following components:

  1. sph_client / schulportal_hessen contains the reusable Python client
  2. api wraps the client in a REST API with caching and additional services
  3. TUI contains a terminal interface that is currently not actively maintained

Supported Modules:

The portal modules are referred to as applets because SPH is built on top of Moodle.

  • login — authenticate and manage session credentials
  • benutzer — user profile and class information
  • mein_unterricht — courses, content, assignments, and attachments
  • kalender — calendar events
  • nachrichten — conversations, recipients, sending, and replies
  • stundenplan — timetable data
  • lerngruppen — study groups
  • school_list — school names and IDs for login and school selection

Installation

API Server

# Install from source
git clone https://github.com/joan-code6/lanis_api.git
pip install -r requirements.txt

Python package

python -m pip install sph-client

Quick Start

API Server

uvicorn api.api:app

The API is available at port 8000 with interactive docs at /docs.

Python package

from sph_client import SchulportalHessenAPI

api = SchulportalHessenAPI()

# Login
result = api.login("1234", "username", "password")
if result.get("success"):
    # Get available modules
    modules = api.get_available_modules()
    print(modules)

    # Fetch messages
    headers = api.nachrichten_get_headers()
    print(headers)

    # Get calendar events
    events = api.kalender_get_events()
    print(events)

    api.logout()

Caching and sessions

The hosted API uses caching and persistent sessions to reduce portal requests and keep navigation responsive.

  • Session TTL: 1 hour inactivity timeout per session
  • Response cache: 10 minutes for most endpoints
  • Long cache (30 days): /modules, /apps, /benutzer
  • School list cache: 2 days with 3-day auto-refresh
  • File cache: SHA-256 hashed, stored in data/files/
  • Background revalidation: stale entries are refreshed asynchronously

Message push notifications

Authenticated users can opt in to daytime message polling from the Lanis UI settings. The default polling window is 07:00–21:00 in the user's configured timezone, with a 15-minute interval. The first poll creates a baseline so enabling the feature does not send old messages as notifications.

Web Push requires these environment variables on the API server:

  • VAPID_PUBLIC_KEY
  • VAPID_PRIVATE_KEY
  • VAPID_SUBJECT (for example, mailto:admin@example.org)

The pywebpush dependency is included in requirements.txt. Users can configure the active window, interval, timezone, and whether notification previews contain the sender and subject in Settings → Nachrichten-Benachrichtigungen.

Deployment

A systemd service file is provided at lanis-api.service:

# Deploy using the provided script
./deploy.sh

API reference

See the generated Python API reference for the complete client surface and method documentation.

License

This project is released under the MIT License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sph_client-0.1.11.tar.gz (63.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sph_client-0.1.11-py3-none-any.whl (56.8 kB view details)

Uploaded Python 3

File details

Details for the file sph_client-0.1.11.tar.gz.

File metadata

  • Download URL: sph_client-0.1.11.tar.gz
  • Upload date:
  • Size: 63.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sph_client-0.1.11.tar.gz
Algorithm Hash digest
SHA256 881a3eef116b65439fdf7bf5a05765e80e97f286699ded721fed5bd1795c708a
MD5 8a9c8f7ec73cde32be6e7512dee06dfb
BLAKE2b-256 041e3f29f8b357f04e5b6f3623a761690d46d37a557f7594d7f8b0bf00d16303

See more details on using hashes here.

Provenance

The following attestation bundles were made for sph_client-0.1.11.tar.gz:

Publisher: pypi.yml on joan-code6/lanis_api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sph_client-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: sph_client-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 56.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sph_client-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 e9be64f694cf2f71df1d2f5afd1fd93141199f8b6215dfd285aff536db2a5f31
MD5 0ebe5b415cec9bea5e05bf5bab457022
BLAKE2b-256 ffb867304b008b0dd12de78222fc1e64c9e854a451af7dabd0a5ab28e1882310

See more details on using hashes here.

Provenance

The following attestation bundles were made for sph_client-0.1.11-py3-none-any.whl:

Publisher: pypi.yml on joan-code6/lanis_api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.11 This release

2 files

0.1.10

2 files

0.1.0

2 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