diff options
Diffstat (limited to 'data/script.py')
-rw-r--r-- | data/script.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/data/script.py b/data/script.py index e7e37e1..911f2a2 100644 --- a/data/script.py +++ b/data/script.py @@ -1,8 +1,12 @@ -api_key="499c19189bmsh1de144300936427p134bd5jsnbdcec35e8f65" +from dotenv import load_dotenv +import os import urllib.parse import requests import json +base_url = "https://wyre-data.p.rapidapi.com/restaurants/localauthority/" + +load_dotenv() boroughs = [ "barking and dagenham", "barnet", @@ -37,15 +41,15 @@ boroughs = [ "wandsworth", "westminster"] -base_url = "https://wyre-data.p.rapidapi.com/restaurants/localauthority/" - final = [] for borough in boroughs: borough_encoded = urllib.parse.quote(borough) - response = requests.get(base_url + borough_encoded, headers={"x-rapidapi-key": api_key}) + response = requests.get(base_url + borough_encoded, headers={"x-rapidapi-key": os.getenv('WYRE_API_KEY')}) results = response.json() + print(results) + for result in results: bizType = result.get("BusinessType", "missing") if(bizType == "Pub/bar/nightclub"): |