Modularize nearby_schools wrapper and pull data for Boston and Buffalo.
This commit is contained in:
17
main/secret.py
Executable file
17
main/secret.py
Executable 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)
|
||||
Reference in New Issue
Block a user