I want to pull data from here: http://www.carqueryapi.com/api/0.3/?callback=?&cmd=getMakes
Here's my python script so far:
import urllib.request
import json
url =("http://www.carqueryapi.com/api/0.3/?callback=?&cmd=getMakes")
request = urllib.request.Request(url)
response = urllib.request.urlopen(request)
result = response.read().decode('utf-8')
print (result)
When I try to manipulate the resultes, starting with:
d = json.loads(result)
I get an error message: "ValueError: No JSON object could be decoded"
What am I doing wrong?
print(result)?(). strip the enclosing parentheses and then you should be able to load the json. also, consider usingrequestsinstead ofurllib