From e2a3341777ddb797aced7566a002848cd1b7f186 Mon Sep 17 00:00:00 2001 From: amercader Date: Fri, 21 Jun 2013 11:46:50 +0100 Subject: [PATCH] [#24] Capture error when we get a wrong API response --- bin/ckan_pycsw.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/ckan_pycsw.py b/bin/ckan_pycsw.py index f7d4a0e..0b006db 100644 --- a/bin/ckan_pycsw.py +++ b/bin/ckan_pycsw.py @@ -137,6 +137,8 @@ def load(pycsw_config, ckan_url): response = requests.get(url) listing = response.json() + if not isinstance(listing, dict): + raise RuntimeError, 'Wrong API response: %s' % listing results = listing.get('results') if not results: break