代碼如下:importrequestsmi_requests=requests.Session()response_first=mi_requests.get(url=login_url_first,headers=login_header_first)printresponse_first.request.headersprintresponse_first.cookies['JSESSIONID']response_second=mi_requests.get(url=login_url_second)printresponse_second.request.headers返回信息:第一個(gè)print{'Accept-Language':'zh-CN,zh;q=0.9','Accept-Encoding':'gzip,deflate','Host':'e.mi.com','Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8','User-Agent':'Mozilla/5.0(WindowsNT10.0;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/65.0.3325.146Safari/537.36','Connection':'keep-alive','Upgrade-Insecure-Requests':'1'}第二個(gè)PrintaaaeKLWkeCfZWhAGOF_iw第三個(gè)Print{'Connection':'keep-alive','Accept-Encoding':'gzip,deflate','Accept':'*/*','User-Agent':'python-requests/2.18.4'}session實(shí)例化,為什么不攜帶http頭信息了?
requests的session為什么不攜帶登錄信息了?
梵蒂岡之花
2019-05-22 21:36:25