mirror of
https://github.com/searxng/searxng
synced 2024-11-03 09:40:20 +00:00
[fix] request header parametering
This commit is contained in:
parent
986c8e51a8
commit
95e4a9353a
@ -69,20 +69,20 @@ def search(query, request, selected_engines):
|
|||||||
for ename, engine in engines.items():
|
for ename, engine in engines.items():
|
||||||
if ename not in selected_engines:
|
if ename not in selected_engines:
|
||||||
continue
|
continue
|
||||||
headers = default_request_params()
|
request_params = default_request_params()
|
||||||
headers['User-Agent'] = user_agent
|
request_params['headers']['User-Agent'] = user_agent
|
||||||
request_params = engine.request(query, headers)
|
request_params = engine.request(query, request_params)
|
||||||
callback = make_callback(ename, results, engine.response)
|
callback = make_callback(ename, results, engine.response)
|
||||||
if request_params['method'] == 'GET':
|
if request_params['method'] == 'GET':
|
||||||
req = grequests.get(request_params['url']
|
req = grequests.get(request_params['url']
|
||||||
,headers=headers
|
,headers=request_params['headers']
|
||||||
,hooks=dict(response=callback)
|
,hooks=dict(response=callback)
|
||||||
,cookies = request_params['cookies']
|
,cookies = request_params['cookies']
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
req = grequests.post(request_params['url']
|
req = grequests.post(request_params['url']
|
||||||
,data=request_params['data']
|
,data=request_params['data']
|
||||||
,headers=headers
|
,headers=request_params['headers']
|
||||||
,hooks=dict(response=callback)
|
,hooks=dict(response=callback)
|
||||||
,cookies = request_params['cookies']
|
,cookies = request_params['cookies']
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user