18 lines
530 B
Python
Executable File
18 lines
530 B
Python
Executable File
#!/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)
|