Main reference#
LanisClient#
- class LanisClient(authentication: LanisAccount | LanisCookie | None, ad_header: Headers = None)#
The interface between python and Schulportal Hessen.
Use
authenticate()
to use this interface.- Parameters:
authentication (LanisAccount or LanisCookie or None) –
A Lanis account with its username and password, and a school id or school name and city in
School
.Cookies with authentication data (school id and session id) in
LanisCookie
for instantly interacting with Lanis. You can obtain this during a session withauthentication_cookies
.If None it will use the session.json, like for the 30-days session or last session (100min), when no session.json exists, it will return
ForceNewAuthenticationError
.
ad_header (httpx.Headers, default {"user-agent": ....}) – Send custom headers to Lanis. Primarily used to send a custom
user-agent
.
Properties#
- property LanisClient.authentication_cookies: LanisCookie#
Return
LanisCookie
with the authentication data (school id and session id) if authenticated. You can use this to authenticate with Lanis instantly.
General functions#
- authenticate(self, session_type: SessionType = SessionType.NORMAL, force: bool = False) None #
Log into the school portal and sets the session id in the auth_cookies.
- Parameters:
force (bool, optional) – If True it always makes a new session with Lanis, by default False
session_type (SessionType, optional by default SessionType.NORMAL) – Which session to create. There are two session types: NORMAL and LONG. The long session is 30-days long (
angemeldet bleiben
option) and needs no password or name to be put in afterwards. It does not force a new session!
Note
Supports only the new system (login.schulportal.hessen.de). More at https://support.schulportal.hessen.de/knowledgebase.php?article=1087.
Authentication types#
- class School#
Alternative to school id for authentication.
- class LanisAccount#
An attrs class to authenticate with this library. It’s a normal Lanis user account.
- class LanisCookie#
An attrs class to authenticate with this library. It’s a cookie with the school id and session id.
- Parameters:
Note
Use
LanisClient.authentication_cookies
from a previous session to getLanisCookie
for the next session.
Get all schools#
Functions#
Getting the Substitution plan#
Functions#
- get_substitution_plan(self) SubstitutionPlan #
Return the whole substitution plan of the current day.
- Return type:
Types#
- class SubstitutionPlan#
The substitution plan page in a data type.
- Parameters:
date (datetime.datetime) – Date of the substitution plan.
substitutions (list[Substitution]) – The individual substitutions.
info (str) –
info
is the box with the title “Allgemein” that exists sometimes.
- class Substitution#
The individual substitution data (table row).
- Parameters:
substitute (str) – Often abbreviation of the substitute.
teacher (str) – Often abbreviation of the teacher.
hours (str) – When is it in school hours.
class_name (str) – Name of the classes.
subject (str) – The subject is rarely given.
room (str) – Room of the substitution.
notice (str) – More info about the substitution.
Getting the Calendar#
Functions#
- get_calendar(self, start: datetime, end: datetime, json: bool = False) Calendar #
Return all calendar events between the start and end date.
- Parameters:
start (datetime.datetime) – Start date
end (datetime.datetime) – End date
json (bool, default False) – Returns Json with every property instead of the limited CalendarData. Defaults to False.
- Returns:
Calendar with Event or Json.
- Return type:
Types#
- class Calendar#
The calendar page in a data type.
- Parameters:
start (datetime.datetime) – Start date and time of the calendar.
end (datetime.datetime) – End date and time of the calendar.
events (list[Calendar] or list[dict[str, any]]) – Use events to access the most important properties. It is either in Calendar or JSON format. When it is in JSON format it has all, including unnecessary ones, properties.
- class Event#
Each calendar cell “event” data.
- Parameters:
title (str) – Name of the event.
description (str) – Description of the event.
place (str) – Place of the event.
start (datetime.datetime) – Start day and time of the event.
end (datetime.datetime) – End day and time of the event. Could also exceed the calendars start and end.
whole_day (bool) – Does it happen the whole day or only between a specific time.
responsible (Callable) – The person who is responsible for this event. You need to call this first, then it returns (hopefully) a string.
Getting all tasks#
Functions#
Types#
- class Task#
The “Mein Unterricht” page in a data type. Expect many parameters to be None.
- Parameters:
title (str) – Name of the task.
date (datetime.datetime) – Creation date of the task.
subject_name (str) – Subject of the task often with the class name and weird ids at the end, like “Chemie 7GA (071CH01-GYM)”
teacher (str) – Abbreviation of the teacher.
description (str) – Optional description of the task.
details (str) –
details
is the blue button with a comment symbol that sometimes appears.attachment_url (str) – Download link to a zip file containing all attachments.
Getting conversations#
Functions#
- get_conversations(self, number: int = 5) list[Conversation] #
Return conversations from the “Nachrichten - Beta-Version”.
- Parameters:
number (int, optional) – The number of conversations to return, by default 5. To get all conversations use -1 but this will take a while and spam Lanis servers.
- Returns:
The conversations in Conversation.
- Return type:
Types#
- class Conversation#
A conversation.
- Parameters:
id (str) – The Uniquid (as Lanis calls it) of a conversation.
title (str) – The title.
teacher (str) – The teacher in full name.
creation_date (str) – When the conversation was created.
newest_date (str) – When the newest comment was created.
unread (bool) – If the user already marked it as read.
special_receivers (list[str]) – Often these are groups of specific people, like Alle SuS or special People, like Admin.
receivers (list[str]) – People with their full name and sometimes class.
content (str) – The content.
comments (None) – Currently always None because it wasn’t implemented yet.
Getting all web applets#
Functions#
Types#
- class Folder#
A Lanis web folder.
- class App#
A Lanis web applet.
- Parameters:
name (str) – The name.
colour (str) – The colour which you can see on Lanis.
folder (list of Folder) – The groups, category, folder or how you want to call it of the app. You can see it on the index page of Lanis.
link (str) – The full Lanis link.
symbol (str) – A symbol which represents this applet. Lanis uses Font Awesome and Glyphicons for this.