Scrapes the new HM FK07 ZPA system and converts the personalized weekly time table to an iCalendar feed file. iCal feeds are compatible with almost all calendar systems (including Gmail) as well as most calendar apps.
- python3 (tested with 3.5)
- BeautifulSoup4 (
pip install BeautifulSoup4) - icalendar (
pip install icalendar) - requests (
pip install requests)
Put your login credentials into a text file, separated by a colon (htaccess-style). Pass the path to this file as the first parameter to zpa2ics.py.
Example credential file:
ifw1234:foobar
Example call which scrapes all weeks from WS16/17:
$ ./zpa2ics.py ~/.zpa_login.conf /var/www/stundenplan.ics 04.10.2016 01.02.2017
It's probably a good idea to add zpa2ics.py to crontab and re-fetch it e.g. daily:
@daily chronic /home/valentin/zpa2/zpa2ics.py ...
This is a quick-and-dirty implementation. The code might look rather adventurous.
The code currently does not verify the (invalid) ZPA certificate. Only use on trusted networks!
- certificate pinning
- convert date strings to objects
- error handling
- cache all weeks but the current one
- don't re-fetch past weeks
- log out when finished?