get school timetable data and messages from WebUntis
Project description
WebUntis-Fetcher
This project is modeled after the web application (by reverse engineering) and does not use a publicly documented and stable API. So it can break at any time - whenever Untis decides to change their backend.
Getting Started
Installation
- Clone this project to your computer, or download the repository content as ZIP file.
- Make sure that at least Python 3.9 is installed.
- Optionally can now set up a venv and install
everything inside it (recommended). For creating it, execute
python3 -m venv venv, and afterwards activate it by executingsource venv/bin/activate. The following steps stay the same, you just have to remember to activate the venv before using webuntis-fetcher later. - Install the package including its dependencies. If you want to be able to do a
git pulllater and not have to re-install it, executepip3 install -e .. If you don't care about that possibility, usepip3 install .. - Test your installation by executing
webuntis-fetcher. An error message should be written to stderr pointing out that no mode was selected.
Fetch Timetable
To configure the mode "timetable", copy
config-template.ini
to e.g. config.ini and edit it so it contains your data.
The section names (inside the []) are used as titles for the time tables,
with the exception of [OUTPUT] which can contain timetable_file - this defines the target
location of the generated timetable. Each other section can contain the following entries.
- The
serverfield has to be set to whatever your school uses. You can see the server name in the browser address bar when you are logged in, it's everything up to the first/. - The
schoolfield has to contain whatever Untis calls the school. You can look it up by logging into your WebUntis account in a web browser and click the RSS icon on the "Today" page (small, orange). The link you're directed to contains the right name (look at the address bar of the browser). - The
classfield is not used to access the backend, but setting it (to any value) switches to "student" mode. Ifclassis unset, the "teacher" mode is used, and class names are displayed next to the period subjects. firstnameandlastnameare used to look up the person for which the time table should be displayed. This way you can use a parent login (which potentially has access to multiple children's time tables) and still determine what should be displayed.teacher_fullname_functioncan be set to the name of a function which returns a dict and is called only once per run - the result is used to result teacher names to their full names because sometimes the "names" in Webuntis are only abbreviations. For an example, seekks_kannover_teachersin the code.statistics_filecan optionally point to a writable location of a XLSX file. Is does not have to exist yet but it will be created if given. The content of this file will be preserved over the weeks, and new data will be appended on the first sheet. The overall statistics on the second sheet will be updated accordingly.
Now you can run webuntis-fetcher timetable periodically, which will write the output to
stdout - or provide a target filename via the config file. Any log messages will go to
stderr. Remember to activate the venv before (if you used one while installing).
You also can add another argument pointing to the location of your config file
if it's not config.ini in your current working directory.
Fetch Messages
To configure the mode "messages", copy
config-template.ini
to e.g. config.ini and edit it so it contains your data.
The section names (inside the []) are used as titles for the time tables,
with the exception of [OUTPUT] which is irrelevant here. As we're fetching messages,
it would make sense to include every login only once, even if if is used for muliple students.
- The
serverfield has to be set to whatever your school uses. You can see the server name in the browser address bar when you are logged in, it's everything up to the first/. - The
schoolfield has to contain whatever Untis calls the school. You can look it up by logging into your WebUntis account in a web browser and click the RSS icon on the "Today" page (small, orange). The link you're directed to contains the right name (look at the address bar of the browser). message_id_fileshould point to any writable file name. It does not have to exist. In this file the IDs of handled messages are stored so you are not notified multiple times for the same message.mail_from,mail_toandmail_hostare self-explanatory.mail_tocan contain multiple addresses separated by a comma.
Now you can run webuntis-fetcher messages periodically, which will will send emails as
configured. Any log messages will go to stderr. Remember to activate the venv before
(if you used one while installing). You also can add another argument pointing to the
location of your config file if it's not config.ini in your current working directory.
Project details
Release history Release notifications | RSS feed
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 webuntis_fetcher-1.tar.gz.
File metadata
- Download URL: webuntis_fetcher-1.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c99cf18dea25b3abb6eeb50dcd8cb83ed773e707a52e094401ee7d5153cd3b90
|
|
| MD5 |
8e155a09eb1a434e8e30016439145208
|
|
| BLAKE2b-256 |
d4b1769dff163754a6a8ef80de416295ad6f9b3e53e0f86a5b9225453938ea67
|
File details
Details for the file webuntis_fetcher-1-py3-none-any.whl.
File metadata
- Download URL: webuntis_fetcher-1-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d68b229104365924112f6092493e1360393c3bb29e8f19431929c6cdfa0413f8
|
|
| MD5 |
fd6953ed5f197aa2fdd2e6736cfb25db
|
|
| BLAKE2b-256 |
086c5c19ebca2e59bba9501a1957188e5ee1aec16ae67a2ff14b61f5aec348f1
|