Working on demographics for remaining schools.
This commit is contained in:
@@ -42,4 +42,27 @@ def get_nearby_schools(key: str, lat: str, lon: str, dist: str):
|
||||
for school in r['schools']:
|
||||
schools.append(school)
|
||||
count = count + 1
|
||||
return schools
|
||||
return schools
|
||||
|
||||
# Endpoint: demographics
|
||||
def get_demographics(key: str, universal_id: str):
|
||||
'''
|
||||
Returns a dictionary of schools received from the nearby schools endpoint.
|
||||
Parameters:
|
||||
key (str): API key
|
||||
lat (str): latitude
|
||||
lon (str): longitude
|
||||
dist (str): radius of search
|
||||
Returns:
|
||||
schools (dict): Collated response from API
|
||||
'''
|
||||
url = f'https://gs-api.greatschools.org/schools/' + '{universal_id}' + '/metrics'
|
||||
params = {
|
||||
}
|
||||
headers = {
|
||||
"x-api-key": key
|
||||
}
|
||||
|
||||
# make request
|
||||
r = requests.get(url=url, params=params, headers=headers).json()
|
||||
print(r)
|
||||
Reference in New Issue
Block a user