python requests get cookies

后端 未结 2 1695
醉梦人生
醉梦人生 2020-11-28 07:17
x = requests.post(url, data=data)
print x.cookies

I used the requests library to get some cookies from a website, but I can only get the cookies fr

2条回答
  •  旧巷少年郎
    2020-11-28 07:57

    If you need the path and thedomain for each cookie, which get_dict() is not exposes, you can parse the cookies manually, for instance:

    [
        {'name': c.name, 'value': c.value, 'domain': c.domain, 'path': c.path}
        for c in session.cookies
    ]
    

提交回复
热议问题