Last active
August 29, 2015 14:03
-
-
Save higs4281/d7c9f1f34ae84a422b23 to your computer and use it in GitHub Desktop.
beach data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import json | |
import requests | |
url = 'https://www.googleapis.com/fusiontables/v1/query?key=AIzaSyAYkamn8YeEjHRpv892i26Mfv6i09eEdPM&sql=SELECT%20beach_id,%20name,%20county,%20mid_lat,%20mid_lon,%20samples,%20pct_samples_bav,%20loc_valid%20FROM%201uK8UlIIOG59txfGjH2WxrDIr_KIxR9lGixkqTple%20WHERE%20state%20=%20%27FL%27&typed=true&callback=jQuery17105043562010396272_1404232573870&_=1404232574998' | |
jtext = requests.get(url).text.split('jQuery17105043562010396272_1404232573870(')[1].strip(');') | |
beaches_dict = json.loads(jtext) | |
with open('beach_data.csv', 'w') as f: | |
writer = csv.writer(f) | |
writer.writerow(beaches_dict['columns']) | |
for each in beaches_dict['rows']: | |
writer.writerow(each) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment