[fix] handling empty resultset

This commit is contained in:
asciimoo 2013-10-20 19:45:13 +02:00
parent 1e8af70192
commit 126682a6ce

View File

@ -18,6 +18,8 @@ def response(resp):
search_res = loads(resp.text) search_res = loads(resp.text)
if 'responseData' not in search_res: if 'responseData' not in search_res:
return [] return []
if 'results' not in search_res['responseData']:
return []
for result in search_res['responseData']['results']: for result in search_res['responseData']['results']:
url = result['originalContextUrl'] url = result['originalContextUrl']
title = result['title'] title = result['title']