Skip to content

Instantly share code, notes, and snippets.

@tianruig
Created October 31, 2015 01:50
Show Gist options
  • Save tianruig/a442e1b917590325aa8b to your computer and use it in GitHub Desktop.
Save tianruig/a442e1b917590325aa8b to your computer and use it in GitHub Desktop.
#! /usr/bin/python3
from urllib.request import urlopen
import json
url = 'http://asuc-mobile.herokuapp.com/api/dining_halls'
response = urlopen(url)
json = json.loads(response.read().decode())
print("""Select a location:
1) Crossroads
2) Clark Kerr
3) Cafe 3
4) Foothill
5) All""")
location = input()
print(location)
if location == 1:
halls = ["Crossroads"]
elif location == 2:
halls = ["Clark Kerr"]
elif location == 3:
halls = ["Cafe 3"]
elif location == 4:
halls = ["Foothill"]
else:
halls = ["Crossroads", "Clark Kerr", "Cafe 3", "Foothill"]
print()
print("""Select a meal:
1) Breakfast
2) Lunch
3) Dinner""")
meal = int(input())
menus = ['breakfast_menu', 'lunch_menu', 'dinner_menu']
for hall in json['dining_halls']:
if hall['name'] in halls:
print()
print('----------------------------------')
print(hall['name'])
print('----------------------------------')
print('*******************')
print(menus[meal-1])
print('*******************')
for item in hall[menus[meal-1]]:
print(item['name'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment