From 68bd8a19e93bcd739e28869ec332e8d404724dbf Mon Sep 17 00:00:00 2001 From: asciimoo Date: Sat, 19 Oct 2013 22:34:46 +0200 Subject: [PATCH] [enh] cookie support --- searx/engines/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py index af2973138..6bfcdab2b 100644 --- a/searx/engines/__init__.py +++ b/searx/engines/__init__.py @@ -50,7 +50,7 @@ for filename in listdir(engine_dir): categories.setdefault(category_name, []).append(engine) 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 process_callback(response, **kwargs): @@ -77,12 +77,14 @@ def search(query, request, selected_engines): req = grequests.get(request_params['url'] ,headers=headers ,hooks=dict(response=callback) + ,cookies = request_params['cookies'] ) else: req = grequests.post(request_params['url'] ,data=request_params['data'] ,headers=headers ,hooks=dict(response=callback) + ,cookies = request_params['cookies'] ) requests.append(req) grequests.map(requests)