【发布时间】:2020-09-21 12:07:10
【问题描述】:
我在使用 python 发送 http 请求时遇到了一些麻烦, 因为 http 标头中的 cookie 会不时自动更改。
如何在不更改 cookie 的情况下通过 http 请求捕获软件发送 http 请求?
我通常会这样发送请求:
import requests as requrl = "somesite.com"headers = {"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)"}resp = req.get(url , headers=headers)print(resp.text)
【问题讨论】:
-
尝试使用
requests.Session -
@Tarique 你能解释一下吗?
标签: python-3.x cookies python-requests