[fix] request header parametering

This commit is contained in:
asciimoo 2013-10-20 20:20:10 +02:00
parent 986c8e51a8
commit 95e4a9353a
1 changed files with 5 additions and 5 deletions

View File

@ -69,20 +69,20 @@ def search(query, request, selected_engines):
for ename, engine in engines.items():
if ename not in selected_engines:
continue
headers = default_request_params()
headers['User-Agent'] = user_agent
request_params = engine.request(query, headers)
request_params = default_request_params()
request_params['headers']['User-Agent'] = user_agent
request_params = engine.request(query, request_params)
callback = make_callback(ename, results, engine.response)
if request_params['method'] == 'GET':
req = grequests.get(request_params['url']
,headers=headers
,headers=request_params['headers']
,hooks=dict(response=callback)
,cookies = request_params['cookies']
)
else:
req = grequests.post(request_params['url']
,data=request_params['data']
,headers=headers
,headers=request_params['headers']
,hooks=dict(response=callback)
,cookies = request_params['cookies']
)