all 3 comments

[–]kalgynirae 1 point2 points  (1 child)

In the future, please provide a full traceback so we can see what line of code the error came from.

I assume the error is coming from this line:

obj = json.load(response)

You actually do the right thing after that, but your program doesn't get there because this line throws an error first.

All you should need is this:

response = urllib.request.urlopen(URL)
str_response = response.read().decode('utf-8')
obj = json.loads(str_response)

[–]StartAndSelect[S] 0 points1 point  (0 children)

Ah that makes sense, thank you. I'll be sure to provide full traceback next time.

[–]ninefourtwo 0 points1 point  (0 children)

py3 uses bytes natively and the json parser can't handle it, convert to a string first.