python使用requests挂fiddler代理时提示SSLError,HTTPSConnectionPool

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33958297/article/details/82291009

错误提示:

SSLError: HTTPSConnectionPool(host='www.baidu.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

1.fiddler证书安装

2.证书安装完成之后 获得crt供requests操作时使用

首先打开internet选项->内容->证书  就到下图了:   

点击导出

将导出到桌面的2.cer改名成2.crt即可使用

再次使用代理设置verify参数 不会出现代理错误的问题

比如:

gHeads = {
    "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36",
}
gProxies = {"http":"http://192.168.0.101:8888","https":"http://192.168.0.101:8888"}
certFile = "./2.crt"
requests.get("https://www.baidu.com",headers=gHeads,proxies=gProxies,verify=certFile).text

猜你喜欢

转载自blog.csdn.net/qq_33958297/article/details/82291009