27 lines
818 B
Python
Executable File
27 lines
818 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
from secret import get_key
|
|
from great_schools import get_nearby_schools
|
|
|
|
import numpy as np
|
|
import pandas as pd
|
|
|
|
# Get secret.
|
|
api_key_file = '../keys/api.key'
|
|
api_key = get_key(api_key_file)
|
|
|
|
# Grab data for Boston.
|
|
refresh = False
|
|
if refresh:
|
|
boston_nearby_schools_file = '../data/nearby_schools/boston.csv'
|
|
boston_schools = get_nearby_schools(api_key,"42.3","-71.2","50")
|
|
boston_df = pd.DataFrame.from_dict(boston_schools)
|
|
boston_df.to_csv(boston_nearby_schools_file)
|
|
|
|
# Grab data for Buffalo.
|
|
refresh = True
|
|
if refresh:
|
|
buffalo_nearby_schools_file = '../data/nearby_schools/buffalo.csv'
|
|
buffalo_schools = get_nearby_schools(api_key,"42.9625","-78.7425","50")
|
|
buffalo_df = pd.DataFrame.from_dict(buffalo_schools)
|
|
buffalo_df.to_csv(buffalo_nearby_schools_file) |