mirror of
https://github.com/searxng/searxng.git
synced 2025-12-22 19:50:00 +00:00
DDG Definitions' unit tests
This commit is contained in:
@@ -25,9 +25,10 @@ def request(query, params):
|
||||
|
||||
|
||||
def response(resp):
|
||||
search_res = json.loads(resp.text)
|
||||
results = []
|
||||
|
||||
search_res = json.loads(resp.text)
|
||||
|
||||
content = ''
|
||||
heading = search_res.get('Heading', '')
|
||||
attributes = []
|
||||
@@ -68,7 +69,7 @@ def response(resp):
|
||||
results.append({'title': heading, 'url': firstURL})
|
||||
|
||||
# related topics
|
||||
for ddg_result in search_res.get('RelatedTopics', None):
|
||||
for ddg_result in search_res.get('RelatedTopics', []):
|
||||
if 'FirstURL' in ddg_result:
|
||||
suggestion = result_to_text(ddg_result.get('FirstURL', None),
|
||||
ddg_result.get('Text', None),
|
||||
|
||||
Reference in New Issue
Block a user