SSLError(“bad handshake”) when trying to access resources Custom Certificates and Requests

点点圈 提交于 2019-12-05 07:47:32
sshussain270

Its an issue you will have to resolve by whitelisting the CA certificate used to sign the remote server certificate you are trying to connect to from your system settings. But for the purposes of testing out only, you can turn off the verification using:

r = requests.get('https:...../PingWs?wsdl',verify=False)

Don't use this in production.

Hope it helps!

This error almost certainly means that the remote endpoint is not signed with a certificate in your local certificate authority store. You have two options:

  • Install the certificate in the CA store that requests uses. By default this is your local system CA store, at least as well as it can be determined by requests.

  • Configure a different set of certificates to be used on a requests session object.

As an example:

import requests.sessions

photon_requests_session = requests.sessions.Session()
photon_requests_session.verify = "/etc/photon/cacerts.pem"

Then I need to make sure that the server CA certificate is in /etc/photon/cacerts.pem. I use this like:

r = photon_requests_session.get(url)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!