summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-02-07 15:35:12 +0100
committerCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-02-07 15:35:12 +0100
commitfb04f76698f8fd7347aa54a42e99ecb7ea5f7df0 (patch)
treef31122a2ebacc32f892bafdf10e4bcef17132678 /searx/engines
parentd0a1df881aa29be713f7446ffff746043b3d0302 (diff)
downloadsearxng-fb04f76698f8fd7347aa54a42e99ecb7ea5f7df0.tar.gz
searxng-fb04f76698f8fd7347aa54a42e99ecb7ea5f7df0.zip
Faroo's unit test
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/faroo.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/searx/engines/faroo.py b/searx/engines/faroo.py
index 5360ea156..4a5e60a60 100644
--- a/searx/engines/faroo.py
+++ b/searx/engines/faroo.py
@@ -37,7 +37,7 @@ search_category = {'general': 'web',
# do search-request
def request(query, params):
- offset = (params['pageno']-1) * number_of_results + 1
+ offset = (params['pageno'] - 1) * number_of_results + 1
categorie = search_category.get(params['category'], 'web')
if params['language'] == 'all':
@@ -45,11 +45,11 @@ def request(query, params):
else:
language = params['language'].split('_')[0]
- # skip, if language is not supported
+ # if language is not supported, put it in english
if language != 'en' and\
language != 'de' and\
language != 'zh':
- return params
+ language = 'en'
params['url'] = search_url.format(offset=offset,
number_of_results=number_of_results,
@@ -69,12 +69,10 @@ def response(resp):
# HTTP-Code 401: api-key is not valide
if resp.status_code == 401:
raise Exception("API key is not valide")
- return []
# HTTP-Code 429: rate limit exceeded
if resp.status_code == 429:
raise Exception("rate limit has been exceeded!")
- return []
results = []