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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
bool paging = True
 
int pagesize = 10
 
str api_site = 'stackoverflow'
 
str api_sort = 'activity'
 
str api_order = 'desc'
 
str search_api = 'https://api.stackexchange.com/2.3/search/advanced?'
 

Detailed Description

Stack Exchange API v2.3

* https://api.stackexchange.com/

Function Documentation

◆ request()

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

Definition at line 32 of file stackexchange.py.

32def request(query, params):
33
34 args = urlencode(
35 {
36 'q': query,
37 'page': params['pageno'],
38 'pagesize': pagesize,
39 'site': api_site,
40 'sort': api_sort,
41 'order': 'desc',
42 }
43 )
44 params['url'] = search_api + args
45
46 return params
47
48

◆ response()

searx.engines.stackexchange.response ( resp)

Definition at line 49 of file stackexchange.py.

49def response(resp):
50
51 results = []
52 json_data = loads(resp.text)
53
54 for result in json_data['items']:
55
56 content = "[%s]" % ", ".join(result['tags'])
57 content += " %s" % result['owner']['display_name']
58 if result['is_answered']:
59 content += ' // is answered'
60 content += " // score: %s" % result['score']
61
62 results.append(
63 {
64 'url': "https://%s.com/q/%s" % (api_site, result['question_id']),
65 'title': html.unescape(result['title']),
66 'content': html.unescape(content),
67 }
68 )
69
70 return results

Variable Documentation

◆ about

dict searx.engines.stackexchange.about
Initial value:
1= {
2 "website": 'https://stackexchange.com',
3 "wikidata_id": 'Q3495447',
4 "official_api_documentation": 'https://api.stackexchange.com/docs',
5 "use_official_api": True,
6 "require_api_key": False,
7 "results": 'JSON',
8}

Definition at line 12 of file stackexchange.py.

◆ api_order

str searx.engines.stackexchange.api_order = 'desc'

Definition at line 26 of file stackexchange.py.

◆ api_site

str searx.engines.stackexchange.api_site = 'stackoverflow'

Definition at line 24 of file stackexchange.py.

◆ api_sort

str searx.engines.stackexchange.api_sort = 'activity'

Definition at line 25 of file stackexchange.py.

◆ pagesize

int searx.engines.stackexchange.pagesize = 10

Definition at line 22 of file stackexchange.py.

◆ paging

bool searx.engines.stackexchange.paging = True

Definition at line 21 of file stackexchange.py.

◆ search_api

str searx.engines.stackexchange.search_api = 'https://api.stackexchange.com/2.3/search/advanced?'

Definition at line 29 of file stackexchange.py.