searx/examples/basic_engine.py

26 lines
521 B
Python
Raw Normal View History

2013-10-14 15:19:25 -07:00
2016-07-11 04:52:37 -07:00
categories = ['general'] # optional
2013-10-19 11:54:21 -07:00
2013-10-14 15:19:25 -07:00
def request(query, params):
'''pre-request callback
params<dict>:
method : POST/GET
headers : {}
data : {} # if method == POST
url : ''
2014-01-29 12:16:55 -08:00
category: 'search category'
pageno : 1 # number of the requested page
2013-10-14 15:19:25 -07:00
'''
params['url'] = 'https://host/%s' % query
return params
def response(resp):
'''post-response callback
resp: requests response object
'''
2013-10-15 10:11:43 -07:00
return [{'url': '', 'title': '', 'content': ''}]