LANiS (Schulportal Hessen) API
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.
Components
This monorepo contains the following components:
- sph_client / schulportal_hessen contains the reusable Python client
- api wraps the client in a REST API with caching and additional services
- 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 credentialsbenutzer— user profile and class informationmein_unterricht— courses, content, assignments, and attachmentskalender— calendar eventsnachrichten— conversations, recipients, sending, and repliesstundenplan— timetable datalerngruppen— study groupsschool_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_KEYVAPID_PRIVATE_KEYVAPID_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.
Metadata
Release files for sph-client 0.1.11
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 | |
|---|---|---|---|---|
| sph_client-0.1.11.tar.gz | 63.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sph_client-0.1.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 120.6 kB
Release files / sph_client-0.1.11.tar.gz
| Download URL | sph_client-0.1.11.tar.gz |
|---|---|
| Size | 63.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
881a3eef116b65439fdf7bf5a05765e80e97f286699ded721fed5bd1795c708a
|
|
BLAKE2b-256 checksum How to use checksums |
041e3f29f8b357f04e5b6f3623a761690d46d37a557f7594d7f8b0bf00d16303
|
| 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 Aug 25, 2026.
Transparency logRelease files / sph_client-0.1.11-py3-none-any.whl
| Download URL | sph_client-0.1.11-py3-none-any.whl |
|---|---|
| Size | 56.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9be64f694cf2f71df1d2f5afd1fd93141199f8b6215dfd285aff536db2a5f31
|
|
BLAKE2b-256 checksum How to use checksums |
ffb867304b008b0dd12de78222fc1e64c9e854a451af7dabd0a5ab28e1882310
|
| 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 Aug 25, 2026.
Transparency logSecurity for sph-client 0.1.11
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 sph_client-0.1.11.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 Aug 25, 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.