From 5c6a5407a0b124c3323e73c33b81ec1fbd7d2fce Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Thu, 17 Dec 2020 16:49:48 +0100 Subject: [PATCH] [fix] fix of PR #2225 --- searx/search/__init__.py | 3 +++ searx/search/processors/online.py | 22 ++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/searx/search/__init__.py b/searx/search/__init__.py index 4511463f3..99459c7a3 100644 --- a/searx/search/__init__.py +++ b/searx/search/__init__.py @@ -166,6 +166,9 @@ class Search: if request_params is None: continue + with threading.RLock(): + processor.engine.stats['sent_search_count'] += 1 + # append request to list requests.append((engineref.name, self.search_query.query, request_params)) diff --git a/searx/search/processors/online.py b/searx/search/processors/online.py index 17bbfef0f..b62f8059e 100644 --- a/searx/search/processors/online.py +++ b/searx/search/processors/online.py @@ -19,15 +19,17 @@ from searx.search.processors.abstract import EngineProcessor logger = logger.getChild('search.processor.online') -DEFAULT_PARAMS = { - 'method': 'GET', - 'headers': {}, - 'data': {}, - 'url': '', - 'cookies': {}, - 'verify': True, - 'auth': None -} + +def default_request_params(): + return { + 'method': 'GET', + 'headers': {}, + 'data': {}, + 'url': '', + 'cookies': {}, + 'verify': True, + 'auth': None + } class OnlineProcessor(EngineProcessor): @@ -45,7 +47,7 @@ class OnlineProcessor(EngineProcessor): return None # add default params - params.update(DEFAULT_PARAMS) + params.update(default_request_params()) # add an user agent params['headers']['User-Agent'] = gen_useragent()