close

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

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error SSLError(“bad handshake”) when trying to access resources Custom Certificates and Requests in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

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

Today I get the following error SSLError(“bad handshake”) when trying to access resources Custom Certificates and Requests in python.

How To Solve SSLError(“bad handshake”) when trying to access resources Custom Certificates and Requests Error ?

  1. How To Solve SSLError(“bad handshake”) when trying to access resources Custom Certificates and Requests Error ?

    To Solve SSLError(“bad handshake”) when trying to access resources Custom Certificates and Requests Error This error almost certainly means that the remote endpoint is not signed with a certificate in your local certificate authority store.

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

Solution 1

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!

Solution 2

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)

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read