python - JSON string decoding error -
i calling url :
http://code.google.com/feeds/issues/p/chromium/issues/full/291?alt=json using urllib2 , decoding using json module
url = "http://code.google.com/feeds/issues/p/chromium/issues/full/291?alt=json" request = urllib2.request(query) response = urllib2.urlopen(request) issue_report = json.loads(response.read()) i run following error :
valueerror: invalid control character at: line 1 column 1120 (char 1120) i tried checking header , got following :
content-type: application/json; charset=utf-8 access-control-allow-origin: * expires: sun, 03 jul 2011 17:38:38 gmt date: sun, 03 jul 2011 17:38:38 gmt cache-control: private, max-age=0, must-revalidate, no-transform vary: accept, x-gdata-authorization, gdata-version gdata-version: 1.0 etag: w/"cuegqx47ecl7ima9wxjafew." last-modified: tue, 04 aug 2009 19:20:20 gmt x-content-type-options: nosniff x-frame-options: sameorigin x-xss-protection: 1; mode=block server: gse connection: close i tried adding encoding parameter follows :
issue_report = json.loads(response.read() , encoding = 'utf-8') i still run same error.
the feed has raw data jpeg in @ point; json malformed, it's not fault. report bug google.
Comments
Post a Comment