This project contains a parser for the canteen / Mensa plans at Ulm University that are provided on the Studierendenwerk Ulm website. You can see the data in action on the UUlm Mensaplan website.
The parsed data is provided via a REST API as well: https://uulm.anter.dev/api/v1/canteens/all
The source code for the REST API is available at Tanikai/uniulm_mensa_api.
These instructions will give you a copy of the project up and running on your local machine for development and testing purposes.
This project is tested and deployed with Python 3.9+. The dependencies require Python 3.7+.
This project is still under active development, so I haven't released a Module on PyPi yet. If you still want to use the current main branch in your project, you can install the Module with the following command:
pip install git+https://github.com/Tanikai/uniulm_mensaparser@main
After installing, you can use the parser like this:
from uniulm_mensaparser import get_plan, Canteen, FsEtAdapter
# use get_plan() to get plans of all supported canteens
plan = get_plan()
print(plan)
# specify which canteen plans you want to be parsed in a set
my_canteens = {Canteen.UL_UNI_Sued, Canteen.UL_UNI_Nord}
# pass an adapter class for a different output format
plan = get_plan(my_canteens, adapter_class=FsEtAdapter)
print(plan)
If you want to extend the functionality of this library (e.g. implementing a new Adapter or PDF parser), you can clone this repository and install the required Python modules:
git clone https://github.com/Tanikai/uniulm_mensaparser.git
cd uniulm_mensaparser
pip install -r requirements.txt
- BeautifulSoup to extract PDF links from the Studierendenwerk Ulm website
- PyMuPDF to scrape the tables of the canteen plan PDFs
Since 2023, there is a new API endpoint for some canteens. This allows us to parse the returned HTML, instead of the PDF file. The following curl command sends a request to the new endpoint. Don't forget to replace the date with the current date.
curl -X POST 'https://sw-ulm-spl51.maxmanager.xyz/inc/ajax-php_konnektor.inc.php?func=make_spl&locId=1&date=2023-07-20&lang=de&startThisWeek=2023-07-17&startNextWeek=2023-07-24'
This project is licensed under the GNU General Public License Version 3 - see the LICENSE file for details