Fetching CricScore easily in Python 3

Using CricketData API in Python is very simple. We’ll assume you know how to work with data in Python, so we’ll just fetch the API data and give it to you in a Python variable named “data”. Thereafter you can manipulate the variable ‘data’ and display / process the output as you see fit!

In Python 3, use this code:

import urllib.request, json
with urllib.request.urlopen("https://api.cricapi.com/v1/cricScore?apikey=%APIKEY%") as url:
data = json.loads(url.read().decode())
print(data)

Replace %APIKEY% with your CricketData.org API key.

And that’s it! The output will be as per the screenshot below

eCricScore and ezCricInfo