Last active
March 5, 2021 02:11
-
-
Save chrislkeller/e9ead8c48cc7dfbb96585020322f992a to your computer and use it in GitHub Desktop.
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
#! /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