Skip to content

Instantly share code, notes, and snippets.

@chrislkeller
Last active March 5, 2021 02:11
Show Gist options
  • Save chrislkeller/e9ead8c48cc7dfbb96585020322f992a to your computer and use it in GitHub Desktop.
Save chrislkeller/e9ead8c48cc7dfbb96585020322f992a to your computer and use it in GitHub Desktop.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import urllib.request
import json
import datetime
timestamp = datetime.datetime.now().strftime("%Y-%m-%d-%H%M%S")
file_output = '{0}-daily-data.json'.format(timestamp)
def handle(url):
response = urllib.request.urlopen(url)
data = json.load(response)
with open(file_output, 'w', encoding='utf-8') as f:
json.dump(data['features'], f, ensure_ascii=False, indent=4)
print('File saved to {0}'.format(file_output))
if __name__ == '__main__':
handle('')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment