请问如何Request文件头headers?
an_url="http://www.test.com"headers={"Content-Type":"application/x-www-form-urlencoded","Cookies":"cookie"}post_data=urllib.urlencode({'id':'xxx','pwd':'xxx'})re_checkin=urllib2.Request(an_url,post_data)
urllib2.Request(an_url,post_data,headers)
[解决办法]
class urllib2.Request(url[, data][, headers][, origin_req_host][, unverifiable])
========================================================
an_url="http://www.test.com"
headers={"Content-Type":"application/x-www-form-urlencoded","Cookies":"cookie"}
post_data=urllib.urlencode({'id':'xxx','pwd':'xxx'})
re_checkin=urllib2.Request(url=an_url,data=post_data,headers=headers)