forked from zaclys/searxng
[enh] api_key usage, disable the engine by default
This commit is contained in:
parent
c051e6a2c3
commit
8c72a22757
|
@ -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
|
||||
|
|
|
@ -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 : ''
|
||||
|
|
Loading…
Reference in New Issue