1、proxies参数设置代理:
verify关键字:默认为true,设置为false表示请求时不验证网站ca
import requestsproxies={'http':"http://127.0.0.1:8080",'https':'https://127.0.0.1:8080'}r=requests.get('http://c.biancheng.net/view/5895.html',proxies=proxies,verify=False)
2、通过环境变量设置代理:
注意:设置完环境变量之后需要重启电脑!
仅修改代理会发生证书认证错误,![TCOFH40Q2W%12B_1UQ~]OZC.png](/uploads/projects/bronlia@qdinuq/bde138ed9cc3f5cdd82b3319a3abbceb.png)
此时将verify参数设置为False,继续报错信息:
raise IOError("Could not find a suitable TLS CA certificate bundle, "OSError: Could not find a suitable TLS CA certificate bundle, invalid path: False
下载burp的证书
获取证书的途径:浏览器输入127.0.0.1:8080
检索报错信息,据说是要个什么pem证书文件,而我下载到的证书文件时der格式,考虑将der转换为pem:
openssl rsa -inform DER -outform PEM -in cacert.der -out cacert.pem
但是我的windows没有openssl,
接下来装openssl,
下载地址:http://slproweb.com/products/Win32OpenSSL.html
配置openssl的环境变量:<br />但是呢,我好像配置失败了。。。<br /><br />先不管了,直接用吧,搜索框搜索openssl,然后再这样这样再那样,然后转换失败了<br /><br />之后阴差阳错下,发现了一个大佬博客:[https://help.aliyun.com/document_detail/40526.html](https://help.aliyun.com/document_detail/40526.html),他说:<br />![Q`9[LA$`B4PYYJ{8C~]C]L2.png](/uploads/projects/bronlia@qdinuq/de82541bd4e5ce2409f1768df3a1eda6.png)
原来有公钥和私钥之分,然后我拿着公钥的命令这样这样再那样,发现转换成功了,
就是不知道能不能用。
openssl x509 -inform der -in cacert.der -out cacert.pem
设置环境变量
REQUESTSCA_BUNDLE=E:\software\anaconda3\envs\BlockSpider.py\cacert.pem

相关链接
复现源:https://www.th3r3p0.com/random/python-requests-and-burp-suite.html
修改verify参数:https://blog.csdn.net/bihui0910/article/details/100950540
pem格式转化时使用公钥:https://help.aliyun.com/document_detail/40526.html
openssl下载链接:http://slproweb.com/products/Win32OpenSSL.html
