get webpage data as json python

import urllib, json

url = "put url here"
response = urllib.request.urlopen(url)
data = json.loads(response.read())
print (data)

Here is what the above code is Doing:
1. It’s creating a variable called url and setting it equal to the url of the API you want to access.
2. It’s creating a variable called response and setting it equal to the response from the API.
3. It’s creating a variable called data and setting it equal to the data from the API.
4. It’s printing the data from the API.