获取CA证书的插件:
import certifi
# 获取CA证书的路径
ca_cert_path = certifi.where()
print(ca_cert_path)
在使用requests库进行HTTPS请求,并且想要确保使用最新的CA证书
import requests
import certifi
response = requests.get('https://example.com', verify=certifi.where())
print(response.status_code)
解决 SSL 证书验证问题:
安装命令中添加--trusted-host参数,让pip忽略 SSL 证书验证进行安装
# 批量安装插件:标红的是需要安装的插件,其它不需要变动
pip install requests pytest pytest-html faker --trusted-host pypi.org --trusted-host files.pythonhosted.org