21 lines
536 B
Python
21 lines
536 B
Python
#!/usr/bin/env python3
|
|
|
|
from great_schools import get_nearby_schools
|
|
|
|
def get_file_contents(filename):
|
|
""" Given a filename,
|
|
return the contents of that file
|
|
"""
|
|
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)
|
|
|
|
api_key_file = '../keys/api.key'
|
|
api_key = get_file_contents(api_key_file)
|
|
|
|
|
|
get_nearby_schools(api_key) |