Message120960
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(). |
|
Date |
User |
Action |
Args |
2010-11-11 16:50:05 | jfinkels | set | recipients:
+ jfinkels |
2010-11-11 16:50:05 | jfinkels | set | messageid: <1289494205.74.0.417330108965.issue10390@psf.upfronthosting.co.za> |
2010-11-11 16:50:01 | jfinkels | link | issue10390 messages |
2010-11-11 16:50:01 | jfinkels | create | |
|