This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jfinkels
Recipients jfinkels
Date 2010-11-11.16:50:01
SpamBayes Score 0.0015421959
Marked as misclassified No
Message-id <1289494205.74.0.417330108965.issue10390@psf.upfronthosting.co.za>
In-reply-to
Content
The following code produces an error:

# APIKEY defined above
r = urllib.request.urlopen('http://api.billboard.com/apisvc/chart/v1/'
                           'list/spec?api_key={}&format=JSON'
                           .format(APIKEY))
j = json.load(r)

Specifically, the urlopen() function returns a request object that can be read, the request object returns a bytes object containing JSON, and the json.load() function tries to mix str and bytes objects when using the re module.

json.load() should convert bytes to str. It is reasonable that one should be able to open a url and pass the result directly to json.load().
History
Date User Action Args
2010-11-11 16:50:05jfinkelssetrecipients: + jfinkels
2010-11-11 16:50:05jfinkelssetmessageid: <1289494205.74.0.417330108965.issue10390@psf.upfronthosting.co.za>
2010-11-11 16:50:01jfinkelslinkissue10390 messages
2010-11-11 16:50:01jfinkelscreate