Python code to fetch menu from sws2.maxmanager.xyz.
Initialize a new selenium webdriver (chrome) object.
browser = init_browser()
Alternative:
chrome_service = webdriver.chrome.service.Service(executable_path=ChromeDriverManager().install())
browser = webdriver.Chrome(service=chrome_service)
Get all available canteen locations with location id \
locations = get_locations(browser)
Example dictionary of locations
{
2: 'MENSA STUTTGART-VAIHINGEN',
16: 'MENSA CENTRAL',
4: 'MENSA MUSIKHOCHSCHULE',
7: 'MENSA KUNSTAKADEMIE',
1: 'MENSA LUDWIGSBURG',
6: 'MENSA FLANDERNSTRAßE',
9: 'MENSA ESSLINGEN STADTMITTE',
12: 'MENSA AM CAMPUS HORB',
13: 'MENSA GöPPINGEN',
21: 'FOODTRUCK'
}
Get a dictionary of today's menu with allergens \
menu = get_today_menu(browser, 16, "en")
Example dictionary of menu
[
{
'category': 'Main dish',
'meal': 'Vegetable sitr fry sweet sour',
'ingredients': []
},
{
'category': 'Main dish',
'meal': 'Omelette with leaf spinach and salt potatoes',
'ingredients': ['egg', 'milk und lactose', 'wheat']
},
{
'category': 'Side dish',
'meal': 'pumpkin carrots vegetable',
'ingredients': []
},
{
'category': 'Dessert',
'meal': 'vanilla pudding',
'ingredients': ['milk und lactose']
}
]