Untis API - InformatikAG/E-paper GitHub Wiki

python Library

login

with webuntis.Session(
    username='', # username
    password='', # password
    server='tipo.webuntis.com',
    school='TBZ Mitte Bremen',
    useragent='E-Paper AG'
).login() as s:

Below this statment you can use s to interact with the untis api. This statement automatically logs you out if your code is finished or you had an exception.

You still need to change the credentials: username, password, server & school.

lists

    for room in s.rooms():
        print(room.name)

In this example, we loop through all rooms and print the name of each room.

This also works for schoolyears, students, teachers & klassen (classes)

timetable

    today = datetime.date.today()
    monday = today - datetime.timedelta(days=today.weekday())
    friday = monday + datetime.timedelta(days=4)

    room = s.rooms().filter(id=1)[0]  # schoolclass #1
    tt = s.timetable(room=room, start=monday, end=friday)
    print(tt)

The first three lines define some variables which are storing dates/times in the right format.

The fourth line gets the room with ID 1.

The last two lines print the timetable of that room from monday to friday

filter

room = s.rooms().filter(name="2.312")[0]

Saves the room with the name "2.312" in the variable room.