来自Python request.session()的请求未记录在Charles中

问题描述 投票:0回答:1

使用Python请求时,我在Charles代理中看到奇怪的行为。以下两个示例均导致成功的响应(200)

1

import requests
response = requests.post(url, headers=headers, data=payload, verify=False)
  • 成功记录在查尔斯

2

request = requests.Request("POST", url, headers=headers, data=payload)

prepared = request.prepare()
session = requests.Session()
session.verify = False

response = session.send(prepared)
  • 未在查尔斯录音

任何想法,为什么Charles不会检测到请求2?它们都由同一个IDE(PyCharm)发送]

Python v3.7 / MacOS Mojave

python python-requests charles-proxy
1个回答
0
投票

例如,尝试设置会话的代理:

session.verify = False
session.proxies = {'http': 'http://127.0.0.1:8888', 'https': 'http://127.0.0.1:8888'}
© www.soinside.com 2019 - 2024. All rights reserved.