From b55b1e0bab4907c65636d517bc06bc9706033fb5 Mon Sep 17 00:00:00 2001 From: Katy Huang Date: Thu, 14 Dec 2023 21:46:16 -0800 Subject: [PATCH] fix the api with google translate trick :D --- api/campusdish_interface.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/api/campusdish_interface.py b/api/campusdish_interface.py index fcc266d..84ebad3 100644 --- a/api/campusdish_interface.py +++ b/api/campusdish_interface.py @@ -13,15 +13,8 @@ def get_menu_data(location, meal_id, date): ''' location_id = LOCATION_INFO[location]['id'] - - response = requests.get( - f'https://uci.campusdish.com/api/menu/GetMenus?locationId={location_id}&periodId={MEAL_TO_PERIOD[meal_id][0]}&date={date}', - headers={'USER-AGENT': 'Mozilla/5.0', - 'accept': 'application/json, text/plain, */*', - 'accept-encoding': 'gzip, deflate, br', - 'accept-language': 'en-US,en;q=0.9', - 'cookie':'_ga=GA1.1.2135650958.1699493067; _fbp=fb.1.1699493068807.546237007; OptanonAlertBoxClosed=2023-11-18T00:27:06.194Z; OptanonConsent=isGpcEnabled=0&datestamp=Mon+Nov+27+2023+16%3A45%3A47+GMT-0800+(Pacific+Standard+Time)&version=6.23.0&isIABGlobal=false&hosts=&consentId=3f8042c6-62c9-459e-b451-8d2bb2d2bb0c&interactionCount=2&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0002%3A1%2CC0004%3A1&geolocation=US%3BCA&AwaitingReconsent=false; _ga_HKPPXV27L6=GS1.1.1701132344.7.1.1701132381.23.0.0; _ga_30LZ5B848R=GS1.1.1701132344.7.1.1701132381.23.0.0; incap_ses_2110_2829404=nmuEMn+X8GCYRr3tTzpIHdc5dWUAAAAAkCfehUkETn3bkUOXJJF9TQ==; AramarkContextInfo=32|{a906eb02-9a20-4c32-83ab-4c44aa7ecae2}|Education; visid_incap_2829404=m7L0fKSVQImqnJ+jFhGClyaxe2UAAAAAQUIPAAAAAAADAaxNzlBTEpAUu2jSBVX4; incap_ses_226_2829404=xksGaJqYfybZsHCSP+oiAyaxe2UAAAAA3Vaw3MCEMfaqz1xnNV5LOw==; __CLAnonymousUser=024VtvBU8JFjAEXI1VYrJfhiw==8E4JagTsXCI5TvhsckSrGtRhrtg8Ba2nvKbKi0oEEqer94E3xhYXibEhXRE+ld898AF9ph8JUW+dQDVwl/vOyVTizKg1NWUaH2cbV0iwhMfa35zlwhSQGRlniC+jmeXfmRIseGcC0/YDWXtDWGdeYBuDzZzLdLVEI+QiZupaYIh7WGLXyKcXB7N2n6NJ97cCMXdFegb240euayuoKELQ3dHATOy/IaiALslPWTiCEk7PEZe6efKRSkreG6QwUVw4TRsRxPbMJ+4hjSVbLq7psIo1+YIE/ZSilIrY/izKcsl2E4Gifa7DoejmUkoscdE39E1gsjdjhrmdBkhukGlMyk4FoRxGNmbnqrnejXlTbe5vLEGV6+Ux8IDe815T5qS/RwjoSJrle6gL2ixz/80RNLTx0WUNujf0DeOMV5/g8RS8eR8ePpGbOg5z1MuccNOQdaboGDa4FAkA9aR2LaIA1xgyhFPEMN2gTRwD7C5G1Vh16GMxgSyZF/aguI2FzcseaZr6FL90qvLeWY6yCg8m7VQQ0TxPSaqQufmYP8Zn53nBegruLSl6T9nXGYFxiaH14Dt2Uwzn5lC/yQAEeEzstHgS0h7+jLfP87RwaWIVjQzHdR4YryHYED++mWj7DlZ5F6lrl4dT/7SGOXfeJhXmb+NF9FAAj8pIHbo8u686DsNBGwXjJmxouuZ2dH5iwV8rAjn0cMayfkfFxRLqaqs6lG+s+MDIWX758R+2Xfjz7n0bBNhtSI1IFUU8DjxsqabUtBnXNerMq+NqYBZSTz1sdvCbBKZkFwZdlLdzvwEEt58=' } - ) + #https://uci-campusdish-com.translate.goog/api/menu/GetMenus?locationId=3314&mode=Daily&date=12/14/2023 + response = requests.get(f'https://uci-campusdish-com.translate.goog/api/menu/GetMenus?locationId={location_id}&date={date}&mode=Daily') if response.status_code == 200: payload = response.json() if 'Menu' in payload: