commit 60409f68f027b27ca2d9f6b90e2a22daefcd506c Author: Pierre-Yves Chibon pingou@pingoured.fr Date: Fri Jun 27 09:51:38 2014 +0200
Handle the situation where the pkgdb2 api did not return a JSON object
This will be likely caused by a 500 error returning the default 500 page/html which will of course not load correctly as JSON.
With --debug we will be able to see what went wrong.
pkgdb2client.py | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) --- diff --git a/pkgdb2client.py b/pkgdb2client.py index b378ef9..5957d2a 100644 --- a/pkgdb2client.py +++ b/pkgdb2client.py @@ -333,7 +333,12 @@ class PkgDB(object): '''
response = self.call_api(path, params, data) - output = response.json() + output = None + try: + output = response.json() + except Exception, err: + LOG.debug('Error while decoding the JSON: {0}'.format(err)) + LOG.debug(response.text)
if response.status_code != 200: LOG.debug('full output %s', output)
packagedb-cli-commits@lists.stg.fedorahosted.org