使用Python请求信任自签名证书
我的apache ssl conf有以下配置
# Server Certificate: SSLCertificateFile /etc/pki/tls/certs/localhost.crt # Server Private Key: SSLCertificateKeyFile /etc/pki/tls/private/localhost.key 我没有此服务器的CA证书.我是否仍然可以将localhost.crt安装到我的客户端以成功验证我的服务器? 在客户端: File "/usr/lib/python2.7/site-packages/requests/adapters.py",line 385,in send raise SSLError(e) SSLError: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed 我做错了吗?我应该只在服务器中添加签署localhost.crt的CA吗? 谢谢, 解决方法
如果你提供了代码并且更清楚你正在做什么,那么你会得到一个很好的答案.
如果您希望即使使用无效证书也不想收到错误,请尝试使用verify = False属性. >>> requests.get(‘https://kennethreitz.com’,verify = False) 如果要使用自定义证书,请将证书放在脚本文件夹中,并使用cert =(‘/ path / client.cert’,’/ path / client.key’)参数. >>> requests.get(‘https://kennethreitz.com’,cert =(‘/ path / client.cert’,’/ path / client.key’)). 有关更多信息,请阅读docs.python-requests.org/en/master/user/advanced/网站 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- python – 在seaborn中使用distplot的FutureWarning
- python – 在pandas中展平系列,即一个元素为列表的系列
- python – 这个程序中的“返回斐波那契……”是怎么回事?
- python – 从可能不完整的候选列表构建2D网格
- python – 为什么运行stratum mining proxy时会出现“Impor
- 如何在python中生成第1000个素数?
- python 正则表达式 概述及常用字符
- Python Ethical Hacking - MAC Address & How to Chang
- python – Numpy矩阵运算
- 它可以在python 3.2中的循环中进行多处理吗?