Create Covid-19 data list using Python in 5 minute


This tutorial will tell how you can create a quick list of Covid-19 pandemic real time data list using simple Python Scrip.

For this we are using data API provided by CovidTracking.com. Our example relay on the JSON data file which offer an up to dated covid-19 data set.

Web Request and urllib2

First we need a web request and bring all the JSON object from the internet. Using urllib2 standard Python library we can fetch the web content as follows.

urldata = 'https://covidtracking.com/api/v1/states/current.json'
    weburl = urllib2.urlopen(urldata)
    print("result code :" + str(weburl.getcode()))
    if (weburl.getcode() == 200):
        data = weburl.read()
        printData(data)
    else:
        print "Some server related error occurs"
PYTHON SPIDER IDE

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.