summaryrefslogtreecommitdiff
path: root/searx/engines/yacy.py
diff options
context:
space:
mode:
authorThomas Pointhuber <thomas.pointhuber@gmx.at>2014-12-16 17:10:20 +0100
committerThomas Pointhuber <thomas.pointhuber@gmx.at>2014-12-16 17:10:20 +0100
commit91f9973227e003604e036278e42a4c6394bf5478 (patch)
treeb5dd64a8df5c194e61c435035cddbd3a76c3696a /searx/engines/yacy.py
parent672f1c674ca63b7589c1bc6b0c32caf439bd16db (diff)
downloadsearxng-91f9973227e003604e036278e42a4c6394bf5478.tar.gz
searxng-91f9973227e003604e036278e42a4c6394bf5478.zip
[fix] pep8
Diffstat (limited to 'searx/engines/yacy.py')
-rw-r--r--searx/engines/yacy.py29
1 files changed, 17 insertions, 12 deletions
diff --git a/searx/engines/yacy.py b/searx/engines/yacy.py
index 3ee0e91c7..4c4fac7df 100644
--- a/searx/engines/yacy.py
+++ b/searx/engines/yacy.py
@@ -24,7 +24,11 @@ number_of_results = 5
# search-url
base_url = 'http://localhost:8090'
-search_url = '/yacysearch.json?{query}&startRecord={offset}&maximumRecords={limit}&contentdom={search_type}&resource=global'
+search_url = '/yacysearch.json?{query}'\
+ '&startRecord={offset}'\
+ '&maximumRecords={limit}'\
+ '&contentdom={search_type}'\
+ '&resource=global' # noqa
# yacy specific type-definitions
search_types = {'general': 'text',
@@ -39,10 +43,11 @@ def request(query, params):
offset = (params['pageno'] - 1) * number_of_results
search_type = search_types.get(params['category'], '0')
- params['url'] = base_url + search_url.format(query=urlencode({'query': query}),
- offset=offset,
- limit=number_of_results,
- search_type=search_type)
+ params['url'] = base_url +\
+ search_url.format(query=urlencode({'query': query}),
+ offset=offset,
+ limit=number_of_results,
+ search_type=search_type)
# add language tag if specified
if params['language'] != 'all':
@@ -70,19 +75,19 @@ def response(resp):
# append result
results.append({'url': result['link'],
- 'title': result['title'],
- 'content': result['description'],
- 'publishedDate': publishedDate})
+ 'title': result['title'],
+ 'content': result['description'],
+ 'publishedDate': publishedDate})
elif resp.search_params['category'] == 'images':
# parse image results
for result in search_results:
# append result
results.append({'url': result['url'],
- 'title': result['title'],
- 'content': '',
- 'img_src': result['image'],
- 'template': 'images.html'})
+ 'title': result['title'],
+ 'content': '',
+ 'img_src': result['image'],
+ 'template': 'images.html'})
#TODO parse video, audio and file results