Skip to main content

A python package for fetching mensa menus at ETH and UNI Zürich

Project description

pyMensa

A python package for accessing mensa menus at ETH and UZH Zürich

Installation

pip3 install pyMensa

Usage

This package lets you access mensa menus at ETH and UZH Zürich. This package will only let you access menus at lunch time of the current day.

Get Meals

It is very simple to get meals for a mensa:

import pyMensa

meals = pyMensa.get_meals("Polymensa")

for meal in meals:
    print(meal)
    print()

Example Output:

LOCAL (STUD:10.50 STAFF:11.50 EXTERN:15.50)
	Dieses Menu servieren wir Ihnen gerne bald wieder!


STREET (STUD:9.90 STAFF:11.90 EXTERN:15.90)
	The New York Burger
	Schweizer Rindfleisch
	oder Vegi-Grillburger
	Sesam Maxi-Bun, Cheddar,
	Eisberg, Tomaten, Gurken, 
	BBQ Relish und Chips

GARDEN (STUD:6.20 STAFF:9.30 EXTERN:12.70)
	Vegan Day
	Seitan mit Blumenkohl,
	Kichererbsen und Harissa-Sauce

etc ...

Get Mensa

You can also just query for a Mensa Object:

import pyMensa

unimensa = pyMensa.get_mensa("uni")

print(unimensa.name)
print(unimensa.aliases)

meals = unimensa.get_meals()
for meal in meals:
    print(meal)
    print()

Example Output:

UZH Zentrum
['zentrum', 'uni', 'uzh zentrum', 'uzhzentrum']
einfach gut (STUD:5.40 STAFF:7.00 EXTERN:10.50)
	 Rindshackfleisch-Pilzragout
	mit hausgemachten Spätzli und Weisskabis
	Fleisch:Rind, CH


natürlich vegi (STUD:5.40 STAFF:7.00 EXTERN:10.50)
	 Gefüllte Aubergine mit Sojagehacktem Tomatensauce und Bratkartoffeln Menüsalat oder Apfelmus

Objects

This is a descripition of all objects used by this package.

Meal

This object describes a generic meal.

Parameters:

Name Type Description
label str The label/name of that meal
price_student str The price for students
price_staff str The price for staff
price_extern str The price for other guests
description str array A list of descriptions, usually ingredients.

Functions:

Name Return Type Description
str str Returns the string representation of the meal

Mensa

This object describes a generic mensa.

Parameters:

Name Type Description
name str The name of the mensa
aliases str array A list of alternative names that can be entered when searching

Functions:

Name Return Type Description
get_meals Meal array Returns list of available Meals
has_alias bool Checks if the given alias corresponds to that mensa

ETH Mensa

This object inherits from the generic Mensa object and implements the get_meals function for the ETH Gastro API

Parameters:

Name Type Description
api_name str The name of the mensa in the ETH Gastro API

Functions:

Name Return Type Description
get_meals Meal array Fetches meals using the ETH Gastro API

UNI Mensa

This object inherits from the generic Mensa object and implements the get_meals function for the UZH Mensa Website which is unfortunately much slower that working with the proper API ETH provides us with, but we have no choice.

Parameters:

Name Type Description
api_name str The name of the mensa on the UZH Mensa Website

Functions:

Name Return Type Description
get_meals Meal array Fetches meals from the UZH Mensa Website

Available Mensas

Here is a list of all available Mensas and their corresponding aliases:

Name Aliases
Mensa Polyterrasse poly, polymensa, polyterrasse, mensa polyterrasse
Food&Lab foodlab, food lab, food&lab
Causiusbar clausius, clausiusbar, lausiusbar, lausius
Polysnack polysnack, snack
Trailerburger foodtrailer, trailer, trailerburger
Alumni quattro Lounge alumni, alumnilounge, alumni lounge
Bellavista bellavista, bella vista
Fusion Meal fusion, fusionmeal, fusion meal
G-ESSbar gess, gessbar, g-essbar, essbar
Tannenbar tanne, tannenbar, tannen bar
Dozentenfoyer dozentenfoyer, dozenten, foyer, dozenten foyer
Plattenstrasse platte, plattestross, plattenstrasse, plattestrass
Rämi 59 rämi, raemi, rämi59, raemi59, rämi 59, raemi 59, raemistrasse, rämistrasse, rämistross
UZH Mercato mercato
UZH Zentrum zentrum, uni, uzh zentrum, uzhzentrum
UZH Lichthof lichthof, rondell
UZH Irchel irchel, irchel mensa, irchelmensa
UZH Irchel Atrium irchel atrium, atrium
UZH Binzmühle binzmühle, binzmuehle
UZH Cityport cityport
UZH Zahnmedizin zahnmedizin, zzm
UZH Tierspital tierspital
UZH Botanischer Garten botanischergarten, botanischer garten, garten, botgarten

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyMensa-1.0.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyMensa-1.0.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file pyMensa-1.0.1.tar.gz.

File metadata

  • Download URL: pyMensa-1.0.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7

File hashes

Hashes for pyMensa-1.0.1.tar.gz
Algorithm Hash digest
SHA256 9953b61c9caccc42095c2f7350b2d567060d9c57a6cf10f3bf744a451955d015
MD5 ced4f49475c40f83f0603446616ef525
BLAKE2b-256 f27e34159584f3c595566d97bd6bc03765ad0047964f683aac1faed50236ce9e

See more details on using hashes here.

File details

Details for the file pyMensa-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyMensa-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7

File hashes

Hashes for pyMensa-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0df3632cc9c25f3922792d06e5f3601a705a006503a299110036b1453c4d4748
MD5 0b590fc78da6fac9f8b280cb39065012
BLAKE2b-256 d891b365a2a9fa21ea927f31985be0a26a6c41ee6ff6890d98ff21ea3a0d3b67

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page