[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:
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))

View File

@ -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()