Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Latest commit

 

History

History
72 lines (63 loc) · 1.47 KB

Readme.md

File metadata and controls

72 lines (63 loc) · 1.47 KB

SWS Canteen Parser

Python code to fetch menu from sws2.maxmanager.xyz.

Documentation

Initialize browser

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 canteen locations

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 today's menu

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']
  }
]