Archived
1
0

Working on demographics for remaining schools.

This commit is contained in:
Shaun Setlock
2022-05-29 22:43:39 -04:00
parent e6a8ad32fe
commit 17309780cf
4 changed files with 271 additions and 580 deletions

View File

@@ -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)