Archived
1
0

Modularize nearby_schools wrapper and pull data for Boston and Buffalo.

This commit is contained in:
Shaun Setlock
2022-04-09 14:55:44 -04:00
parent 557c7103b4
commit 6a6fa834f3
6 changed files with 2201 additions and 21 deletions

17
main/secret.py Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env python3
def get_key(filename: str):
"""
Provide a path to a valid file, this will return the contents.
Parameters:
filename (str): path to file
Returns:
schools (dict): Collated response from API
"""
try:
with open(filename, 'r') as f:
# It's assumed our file contains a single line,
# with our API key
return f.read().strip()
except FileNotFoundError:
print("'%s' file not found" % filename)