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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ['science']
 
bool paging = True
 
int page_size = 20
 
str url = 'https://scanr.enseignementsup-recherche.gouv.fr/'
 
str search_url = url + 'api/structures/search'
 

Detailed Description

 ScanR Structures (Science)

Function Documentation

◆ request()

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

Definition at line 30 of file scanr_structures.py.

30def request(query, params):
31
32 params['url'] = search_url
33 params['method'] = 'POST'
34 params['headers']['Content-type'] = "application/json"
35 params['data'] = dumps(
36 {
37 "query": query,
38 "searchField": "ALL",
39 "sortDirection": "ASC",
40 "sortOrder": "RELEVANCY",
41 "page": params['pageno'],
42 "pageSize": page_size,
43 }
44 )
45
46 return params
47
48
49# get response from search-request

◆ response()

searx.engines.scanr_structures.response ( resp)

Definition at line 50 of file scanr_structures.py.

50def response(resp):
51 results = []
52
53 search_res = loads(resp.text)
54
55 # return empty array if there are no results
56 if search_res.get('total', 0) < 1:
57 return []
58
59 # parse results
60 for result in search_res['results']:
61 if 'id' not in result:
62 continue
63
64 # is it thumbnail or img_src??
65 thumbnail = None
66 if 'logo' in result:
67 thumbnail = result['logo']
68 if thumbnail[0] == '/':
69 thumbnail = url + thumbnail
70
71 content = None
72 if 'highlights' in result:
73 content = result['highlights'][0]['value']
74
75 # append result
76 results.append(
77 {
78 'url': url + 'structure/' + result['id'],
79 'title': result['label'],
80 'thumbnail': thumbnail,
81 'content': html_to_text(content),
82 }
83 )
84
85 # return results
86 return results

Variable Documentation

◆ about

dict searx.engines.scanr_structures.about
Initial value:
1= {
2 "website": 'https://scanr.enseignementsup-recherche.gouv.fr',
3 "wikidata_id": 'Q44105684',
4 "official_api_documentation": 'https://scanr.enseignementsup-recherche.gouv.fr/opendata',
5 "use_official_api": True,
6 "require_api_key": False,
7 "results": 'JSON',
8}

Definition at line 10 of file scanr_structures.py.

◆ categories

list searx.engines.scanr_structures.categories = ['science']

Definition at line 20 of file scanr_structures.py.

◆ page_size

int searx.engines.scanr_structures.page_size = 20

Definition at line 22 of file scanr_structures.py.

◆ paging

bool searx.engines.scanr_structures.paging = True

Definition at line 21 of file scanr_structures.py.

◆ search_url

str searx.engines.scanr_structures.search_url = url + 'api/structures/search'

Definition at line 26 of file scanr_structures.py.

◆ url

str searx.engines.scanr_structures.url = 'https://scanr.enseignementsup-recherche.gouv.fr/'

Definition at line 25 of file scanr_structures.py.