[#24] Capture error when we get a wrong API response

This commit is contained in:
amercader 2013-06-21 11:46:50 +01:00
parent edd61f3a5b
commit e2a3341777
1 changed files with 2 additions and 0 deletions

View File

@ -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