summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorpotato <mail@crazypotato.tk>2016-09-06 16:12:34 +0200
committerpotato <mail@crazypotato.tk>2016-09-06 16:12:34 +0200
commit8c72a22757290754fc15fecb82dd157f6ea56a7f (patch)
treecd93a75690adde9dbc3d61d65e74f3c539870e71 /searx
parentc051e6a2c3e97419983d552594a6a8340339c1d5 (diff)
[enh] api_key usage, disable the engine by default
Diffstat (limited to 'searx')
-rw-r--r--searx/engines/translated.py10
-rw-r--r--searx/settings.yml3
2 files changed, 10 insertions, 3 deletions
diff --git a/searx/engines/translated.py b/searx/engines/translated.py
index 2f535140c..3be9d4adf 100644
--- a/searx/engines/translated.py
+++ b/searx/engines/translated.py
@@ -7,11 +7,12 @@ from searx.languages import language_codes
categories = ['general']
url = 'http://api.mymemory.translated.net/get?q={query}' \
- '&langpair={from_lang}|{to_lang}'
+ '&langpair={from_lang}|{to_lang}{key}'
web_url = 'http://mymemory.translated.net/en/{from_lang}/{to_lang}/{query}'
weight = 100
parser_re = re.compile(u'.*?([a-z]+)-([a-z]+) (.{2,})$', re.I)
+api_key = ''
def is_valid_lang(lang):
@@ -41,9 +42,14 @@ def request(query, params):
if not from_lang or not to_lang:
return params
+ if api_key:
+ key_form = '&key=' + api_key
+ else:
+ key_form = ''
params['url'] = url.format(from_lang=from_lang[1],
to_lang=to_lang[1],
- query=query)
+ query=query,
+ key=key_form)
params['query'] = query
params['from_lang'] = from_lang
params['to_lang'] = to_lang
diff --git a/searx/settings.yml b/searx/settings.yml
index ba5824bb1..63a4b0acf 100644
--- a/searx/settings.yml
+++ b/searx/settings.yml
@@ -7,7 +7,7 @@ search:
autocomplete : "" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "wikipedia" - leave blank to turn it off by default
server:
- port : 8888
+ port : 8889
bind_address : "127.0.0.1" # address to listen on
secret_key : "ultrasecretkey" # change this!
base_url : False # Set custom base_url. Possible values: False or "https://your.custom.host/location/"
@@ -503,6 +503,7 @@ engines:
engine : translated
shortcut : tl
timeout : 5.0
+ disabled : True
# You can use without an API key, but you are limited to 1000 words/day
# See : http://mymemory.translated.net/doc/usagelimits.php
# api_key : ''