.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.engines.translated Namespace Reference

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
str engine_type = 'online_dictionary'
 
list categories = ['general', 'translate']
 
str url = 'https://api.mymemory.translated.net/get?q={query}&langpair={from_lang}|{to_lang}{key}'
 
str web_url = 'https://mymemory.translated.net/en/{from_lang}/{to_lang}/{query}'
 
int weight = 100
 
bool https_support = True
 
str api_key = ''
 

Detailed Description

MyMemory Translated

Function Documentation

◆ request()

searx.engines.translated.request ( query,
params )

Definition at line 26 of file translated.py.

26def request(query, params): # pylint: disable=unused-argument
27 if api_key:
28 key_form = '&key=' + api_key
29 else:
30 key_form = ''
31 params['url'] = url.format(
32 from_lang=params['from_lang'][1], to_lang=params['to_lang'][1], query=params['query'], key=key_form
33 )
34 return params
35
36

◆ response()

searx.engines.translated.response ( resp)

Definition at line 37 of file translated.py.

37def response(resp):
38 results = []
39 results.append(
40 {
41 'url': web_url.format(
42 from_lang=resp.search_params['from_lang'][2],
43 to_lang=resp.search_params['to_lang'][2],
44 query=resp.search_params['query'],
45 ),
46 'title': '[{0}-{1}] {2}'.format(
47 resp.search_params['from_lang'][1], resp.search_params['to_lang'][1], resp.search_params['query']
48 ),
49 'content': resp.json()['responseData']['translatedText'],
50 }
51 )
52 return results

References searx.format.

Variable Documentation

◆ about

dict searx.engines.translated.about
Initial value:
1= {
2 "website": 'https://mymemory.translated.net/',
3 "wikidata_id": None,
4 "official_api_documentation": 'https://mymemory.translated.net/doc/spec.php',
5 "use_official_api": True,
6 "require_api_key": False,
7 "results": 'JSON',
8}

Definition at line 7 of file translated.py.

◆ api_key

str searx.engines.translated.api_key = ''

Definition at line 23 of file translated.py.

◆ categories

list searx.engines.translated.categories = ['general', 'translate']

Definition at line 17 of file translated.py.

◆ engine_type

str searx.engines.translated.engine_type = 'online_dictionary'

Definition at line 16 of file translated.py.

◆ https_support

bool searx.engines.translated.https_support = True

Definition at line 21 of file translated.py.

◆ url

str searx.engines.translated.url = 'https://api.mymemory.translated.net/get?q={query}&langpair={from_lang}|{to_lang}{key}'

Definition at line 18 of file translated.py.

◆ web_url

str searx.engines.translated.web_url = 'https://mymemory.translated.net/en/{from_lang}/{to_lang}/{query}'

Definition at line 19 of file translated.py.

◆ weight

int searx.engines.translated.weight = 100

Definition at line 20 of file translated.py.