如何通过fiddler2捕获Python SSL(HTTPS)连接

6
我正在尝试通过Fiddler2本地代理捕获Python SSL(HTTPS)连接。 但是我只收到了一个错误。 代码:
import requests
requests.get("https://www.python.org", proxies={"http": "http://127.0.0.1:8888", "https":"http:127.0.0.1:8888"},cert=r"FiddlerRoot.cer")

错误信息

requests.exceptions.SSLError: [Errno 1] _ssl.c:510: error:14090086:SSL routines:
SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

请问有什么方法可以修复这个错误,但不需要把验证设置为False吗?我已经在Windows 7系统上接受了“FiddlerRoot.cer”,但是没有任何改变。

  • Python 2.7
  • Windows 7
1个回答

11
requests.get("https://www.python.org", proxies={"http": "http://127.0.0.1:8888", "https":"http:127.0.0.1:8888"},verify=r"FiddlerRoot.pem")

我需要将.cer(DER格式)文件转换为.pem(PEM格式),但我发现cert参数并不是我想要使用的。上面的代码对我来说是一个解决方案。


2
在控制台中执行命令 openssl x509 -inform der -in FiddlerRoot.cer -out FiddlerRoot.pem - fx-kirin

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接