python requests 获取cookie中的某个值
url = "https://www.imooc.com/user/ssologin?token=y4uSCZGOsbTjt1xzJXrZciaRKTcI3DXHvqyh02cVyLb5-wS06bvrrDoyFleOoPs4v0T5B26R5tWctPGcP8cfeDnaym3HRIbsXuDffenFmRWTLG5U70THZtt7wO7Sd1ZsNLUH3KmIPCqIv9v0unsRW6UTxgBg95svOUkrGs02HIuf1gJ4XYFBn8GRbdStk4bWiWz5m7rpQzW-Kr0rCXTB42WvLGcaocFWwaRjgzMpxyEtL-eM_lozBbL1FtZ3D9rF-TNKFnLitrzmwv&callback=jQuery21002697920187963523_1587653297461&_=1587653297463"
result = requests.get(url,verify = False,proxies = {"http": "http://127.0.0.1:9999","https": "http://127.0.0.1:9999"})
print(result.cookies)
cookie = requests.utils.dict_from_cookiejar(result.cookies)
print(cookie)
结果:
<RequestsCookieJar[<Cookie cvde=5ea1ab8887d05-1 for .imooc.com/>, <Cookie imooc_isnew=1 for .imooc.com/>, <Cookie imooc_isnew_ct=1587653512 for .imooc.com/>, <Cookie imooc_uuid=9266ee52-70c8-452b-915c-0a174ff677a2 for .imooc.com/>]>
{'cvde': '5ea1ab8887d05-1', 'imooc_isnew': '1', 'imooc_isnew_ct': '1587653512', 'imooc_uuid': '9266ee52-70c8-452b-915c-0a174ff677a2'}