Skip to content

Instantly share code, notes, and snippets.

@bigsnarfdude
Last active March 23, 2020 03:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bigsnarfdude/79617d5c332fd13bd816822438c27bc8 to your computer and use it in GitHub Desktop.
Save bigsnarfdude/79617d5c332fd13bd816822438c27bc8 to your computer and use it in GitHub Desktop.
bc_cdc.py
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