python 怎么获取cookies

2025-04-24 20:09:46
推荐回答(1个)
回答1:

使用requests这个库吧

import requests

url = "
r = requests.get(url,timeout=5)
if r.status_code == 200:
    for cookie in r.cookies:
        print(cookie)            # Use "print cookie" if you use Python 2.