Last active
March 23, 2020 03:57
-
-
Save bigsnarfdude/79617d5c332fd13bd816822438c27bc8 to your computer and use it in GitHub Desktop.
bc_cdc.py
This file contains 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 urllib.request | |
import json | |
body = {} | |
myurl = 'https://bc-covid-counts-uac6u.transposit.io/api/v1/execute/get_bc_covid_data' | |
req = urllib.request.Request(myurl) | |
req.add_header('Content-Type', 'application/json; charset=utf-8') | |
jsondata = json.dumps(body) | |
jsondataasbytes = jsondata.encode('utf-8') # needs to be bytes | |
req.add_header('Content-Length', len(jsondataasbytes)) | |
print (jsondataasbytes) | |
response = urllib.request.urlopen(req, jsondataasbytes) | |
data = response.read() | |
dta | |
data | |
history | |
pandas.read_json | |
import pandas as pd | |
pd.read_json(data) | |
df = pd.read_json(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment