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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
 categories = searx_categories.keys()
 
list instance_urls = []
 
int instance_index = 0
 

Detailed Description

 Searx (all)

Function Documentation

◆ request()

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

Definition at line 27 of file searx_engine.py.

27def request(query, params):
28 global instance_index # pylint: disable=global-statement
29 params['url'] = instance_urls[instance_index % len(instance_urls)]
30 params['method'] = 'POST'
31
32 instance_index += 1
33
34 params['data'] = {
35 'q': query,
36 'pageno': params['pageno'],
37 'language': params['language'],
38 'time_range': params['time_range'],
39 'category': params['category'],
40 'format': 'json',
41 }
42
43 return params
44
45
46# get response from search-request

◆ response()

searx.engines.searx_engine.response ( resp)

Definition at line 47 of file searx_engine.py.

47def response(resp):
48
49 response_json = loads(resp.text)
50 results = response_json['results']
51
52 for i in ('answers', 'infoboxes'):
53 results.extend(response_json[i])
54
55 results.extend({'suggestion': s} for s in response_json['suggestions'])
56
57 results.append({'number_of_results': response_json['number_of_results']})
58
59 return results

Variable Documentation

◆ about

dict searx.engines.searx_engine.about
Initial value:
1= {
2 "website": 'https://github.com/searxng/searxng',
3 "wikidata_id": 'Q17639196',
4 "official_api_documentation": 'https://docs.searxng.org/dev/search_api.html',
5 "use_official_api": True,
6 "require_api_key": False,
7 "results": 'JSON',
8}

Definition at line 10 of file searx_engine.py.

◆ categories

searx.engines.searx_engine.categories = searx_categories.keys()

Definition at line 19 of file searx_engine.py.

◆ instance_index

int searx.engines.searx_engine.instance_index = 0

Definition at line 23 of file searx_engine.py.

◆ instance_urls

list searx.engines.searx_engine.instance_urls = []

Definition at line 22 of file searx_engine.py.