Skip to content

Instantly share code, notes, and snippets.

@peeterskris
Created November 11, 2016 13:43
Show Gist options
  • Save peeterskris/9b0d0b50307627fad0a8a22a101e7764 to your computer and use it in GitHub Desktop.
Save peeterskris/9b0d0b50307627fad0a8a22a101e7764 to your computer and use it in GitHub Desktop.
def retrieve_stations(stations_url, folder):
response = requests.get(stations_url, headers={'accept': 'application/json'}, verify=False)
if response.ok:
data = json.loads(response.content)
filename = path.join(folder, 'stations.json')
with open(filename, 'w') as outfile:
json.dump(data, outfile, indent=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment