summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2020-12-17 16:49:48 +0100
committerAlexandre Flament <alex@al-f.net>2020-12-17 16:49:48 +0100
commit5c6a5407a0b124c3323e73c33b81ec1fbd7d2fce (patch)
tree7bf9ee6ad860388840a463162d7e2d144bd206ff
parent9b27935f71ea94ba034d73c09c1f18df05fd33b6 (diff)
downloadsearxng-5c6a5407a0b124c3323e73c33b81ec1fbd7d2fce.tar.gz
searxng-5c6a5407a0b124c3323e73c33b81ec1fbd7d2fce.zip
[fix] fix of PR #2225
-rw-r--r--searx/search/__init__.py3
-rw-r--r--searx/search/processors/online.py22
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()