forked from zaclys/searxng
[enh] request timeout added
This commit is contained in:
parent
c3c9d147ce
commit
a8797839a1
@ -120,16 +120,18 @@ def search(query, request, selected_categories):
|
||||
callback = make_callback(selected_engine['name'], results, engine.response, request_params)
|
||||
if request_params['method'] == 'GET':
|
||||
req = grequests.get(request_params['url']
|
||||
,headers=request_params['headers']
|
||||
,hooks=dict(response=callback)
|
||||
,headers = request_params['headers']
|
||||
,hooks = dict(response=callback)
|
||||
,cookies = request_params['cookies']
|
||||
,timeout = settings.timeout
|
||||
)
|
||||
else:
|
||||
req = grequests.post(request_params['url']
|
||||
,data=request_params['data']
|
||||
,headers=request_params['headers']
|
||||
,hooks=dict(response=callback)
|
||||
,data = request_params['data']
|
||||
,headers = request_params['headers']
|
||||
,hooks = dict(response=callback)
|
||||
,cookies = request_params['cookies']
|
||||
,timeout = settings.timeout
|
||||
)
|
||||
requests.append(req)
|
||||
grequests.map(requests)
|
||||
|
@ -3,7 +3,9 @@ port = 8888
|
||||
|
||||
secret_key = "ultrasecretkey" # change this!
|
||||
|
||||
debug = False
|
||||
debug = True
|
||||
|
||||
request_timeout = 5.0 # seconds
|
||||
|
||||
weights = {} # 'search_engine_name': float(weight) | default is 1.0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user