猿问

requests的session为什么不携带登录信息了?

代码如下:
importrequests
mi_requests=requests.Session()
response_first=mi_requests.get(url=login_url_first,headers=login_header_first)
printresponse_first.request.headers
printresponse_first.cookies['JSESSIONID']
response_second=mi_requests.get(url=login_url_second)
printresponse_second.request.headers
返回信息:
第一个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'}
第二个Print
aaaeKLWkeCfZWhAGOF_iw
第三个Print
{'Connection':'keep-alive','Accept-Encoding':'gzip,deflate','Accept':'*/*','User-Agent':'python-requests/2.18.4'}
session实例化,为什么不携带http头信息了?
梵蒂冈之花
浏览 999回答 2
2回答

摇曳的蔷薇

response_second=mi_requests.get(url=login_url_second,headers=login_header_first)
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答