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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
881a3eef116b65439fdf7bf5a05765e80e97f286699ded721fed5bd1795c708a
|
|
| MD5 |
8a9c8f7ec73cde32be6e7512dee06dfb
|
|
| BLAKE2b-256 |
041e3f29f8b357f04e5b6f3623a761690d46d37a557f7594d7f8b0bf00d16303
|
Provenance
The following attestation bundles were made for sph_client-0.1.11.tar.gz:
Publisher:
pypi.yml on joan-code6/lanis_api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sph_client-0.1.11.tar.gz -
Subject digest:
881a3eef116b65439fdf7bf5a05765e80e97f286699ded721fed5bd1795c708a - Sigstore transparency entry: 2584793762
- Sigstore integration time:
-
Permalink:
joan-code6/lanis_api@03051358b227b6c8106a516ede5f8129220d0fe9 -
Branch / Tag:
refs/tags/v0.1.11 - Owner: https://github.com/joan-code6
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@03051358b227b6c8106a516ede5f8129220d0fe9 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9be64f694cf2f71df1d2f5afd1fd93141199f8b6215dfd285aff536db2a5f31
|
|
| MD5 |
0ebe5b415cec9bea5e05bf5bab457022
|
|
| BLAKE2b-256 |
ffb867304b008b0dd12de78222fc1e64c9e854a451af7dabd0a5ab28e1882310
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sph_client-0.1.11-py3-none-any.whl -
Subject digest:
e9be64f694cf2f71df1d2f5afd1fd93141199f8b6215dfd285aff536db2a5f31 - Sigstore transparency entry: 2584794226
- Sigstore integration time:
-
Permalink:
joan-code6/lanis_api@03051358b227b6c8106a516ede5f8129220d0fe9 -
Branch / Tag:
refs/tags/v0.1.11 - Owner: https://github.com/joan-code6
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@03051358b227b6c8106a516ede5f8129220d0fe9 -
Trigger Event:
push
-
Statement type: