aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-01-18 20:38:00 +0100
committerneodarz <neodarz@neodarz.net>2019-01-18 20:50:40 +0100
commit6b6cbdae20f298fc4761798dbbccdddd858af515 (patch)
treee6a571ed1730fa7f2a73a505b184cfc12efe4693 /src
parent1e9c7b9daac9bdee0822b66efdf607eed1e24452 (diff)
downloadryzomcore_searx-6b6cbdae20f298fc4761798dbbccdddd858af515.tar.xz
ryzomcore_searx-6b6cbdae20f298fc4761798dbbccdddd858af515.zip
Fix error when result not found
Diffstat (limited to 'src')
-rw-r--r--src/khanindexer.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/khanindexer.py b/src/khanindexer.py
index dc020de..abfce3f 100644
--- a/src/khanindexer.py
+++ b/src/khanindexer.py
@@ -36,12 +36,15 @@ def response(resp):
datas = json.loads(resp.text)
- for el in datas:
- results.append({
- 'title': el['title'],
- 'content': el['excerpts'][0],
- 'url': el['url']
- })
+ if not 'error' in datas:
+ for el in datas:
+ results.append({
+ 'title': el['title'],
+ 'content': el['excerpts'][0],
+ 'url': el['url']
+ })
+ else:
+ print("ERROR:Search server: "+str(datas['msg']))
# return results
return results