With Python3 I am requesting from some url a json document.
response = urllib.request.urlopen(request)
obj = json.load(fp)
obj = json.load(response)
str_response = response.readall().decode('utf-8')
obj = json.loads(str_response)
HTTP sends bytes. If the resource in question is text, the character encoding is normally specified, either by the Content-Type HTTP header or by another mechanism (an RFC, HTML
urllib should know how to encode the bytes to a string, but it's too naïve—it's a horribly underpowered and un-Pythonic library.
Dive Into Python 3 provides an overview about the situation.
Your "work-around" is fine—although it feels wrong, it's the correct way to do it.