summaryrefslogtreecommitdiff
path: root/searx/engines/duckduckgo_definitions.py
diff options
context:
space:
mode:
authorCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-02-09 18:28:08 +0100
committerCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-02-09 18:28:08 +0100
commit8c2a5f04926473a2a89667b7603e21cc31b80f61 (patch)
treeddf4a84a1f4a30853abf116ee528641eee5d8610 /searx/engines/duckduckgo_definitions.py
parent0a537d3b89964c227724d3cd95adebd2bbafb720 (diff)
downloadsearxng-8c2a5f04926473a2a89667b7603e21cc31b80f61.tar.gz
searxng-8c2a5f04926473a2a89667b7603e21cc31b80f61.zip
DDG Definitions' unit tests
Diffstat (limited to 'searx/engines/duckduckgo_definitions.py')
-rw-r--r--searx/engines/duckduckgo_definitions.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/searx/engines/duckduckgo_definitions.py b/searx/engines/duckduckgo_definitions.py
index b66d6c0f2..793e97d22 100644
--- a/searx/engines/duckduckgo_definitions.py
+++ b/searx/engines/duckduckgo_definitions.py
@@ -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),