mirror of https://github.com/searxng/searxng.git
[enh] cookie support
This commit is contained in:
parent
111a86aa22
commit
68bd8a19e9
|
@ -50,7 +50,7 @@ for filename in listdir(engine_dir):
|
||||||
categories.setdefault(category_name, []).append(engine)
|
categories.setdefault(category_name, []).append(engine)
|
||||||
|
|
||||||
def default_request_params():
|
def default_request_params():
|
||||||
return {'method': 'GET', 'headers': {}, 'data': {}, 'url': ''}
|
return {'method': 'GET', 'headers': {}, 'data': {}, 'url': '', 'cookies': {}}
|
||||||
|
|
||||||
def make_callback(engine_name, results, callback):
|
def make_callback(engine_name, results, callback):
|
||||||
def process_callback(response, **kwargs):
|
def process_callback(response, **kwargs):
|
||||||
|
@ -77,12 +77,14 @@ def search(query, request, selected_engines):
|
||||||
req = grequests.get(request_params['url']
|
req = grequests.get(request_params['url']
|
||||||
,headers=headers
|
,headers=headers
|
||||||
,hooks=dict(response=callback)
|
,hooks=dict(response=callback)
|
||||||
|
,cookies = request_params['cookies']
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
req = grequests.post(request_params['url']
|
req = grequests.post(request_params['url']
|
||||||
,data=request_params['data']
|
,data=request_params['data']
|
||||||
,headers=headers
|
,headers=headers
|
||||||
,hooks=dict(response=callback)
|
,hooks=dict(response=callback)
|
||||||
|
,cookies = request_params['cookies']
|
||||||
)
|
)
|
||||||
requests.append(req)
|
requests.append(req)
|
||||||
grequests.map(requests)
|
grequests.map(requests)
|
||||||
|
|
Loading…
Reference in New Issue