[fix] fix of PR #2225

This commit is contained in:
Alexandre Flament 2020-12-17 16:49:48 +01:00
parent 9b27935f71
commit 5c6a5407a0
2 changed files with 15 additions and 10 deletions

View file

@ -166,6 +166,9 @@ class Search:
if request_params is None: if request_params is None:
continue continue
with threading.RLock():
processor.engine.stats['sent_search_count'] += 1
# append request to list # append request to list
requests.append((engineref.name, self.search_query.query, request_params)) requests.append((engineref.name, self.search_query.query, request_params))

View file

@ -19,7 +19,9 @@ from searx.search.processors.abstract import EngineProcessor
logger = logger.getChild('search.processor.online') logger = logger.getChild('search.processor.online')
DEFAULT_PARAMS = {
def default_request_params():
return {
'method': 'GET', 'method': 'GET',
'headers': {}, 'headers': {},
'data': {}, 'data': {},
@ -45,7 +47,7 @@ class OnlineProcessor(EngineProcessor):
return None return None
# add default params # add default params
params.update(DEFAULT_PARAMS) params.update(default_request_params())
# add an user agent # add an user agent
params['headers']['User-Agent'] = gen_useragent() params['headers']['User-Agent'] = gen_useragent()