close

How to get Python requests to trust a self signed SSL certificate?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to get Python requests to trust a self signed SSL certificate in Python. So Here I am Explain to you all the possible Methods here.

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

Table of Contents

How to get Python requests to trust a self signed SSL certificate?

  1. How to get Python requests to trust a self signed SSL certificate?

    The easiest is to export the variable REQUESTS_CA_BUNDLE that points to your private certificate authority, or a specific certificate bundle.

  2. get Python requests to trust a self signed SSL certificate

    The easiest is to export the variable REQUESTS_CA_BUNDLE that points to your private certificate authority, or a specific certificate bundle.

Method 1

try:

r = requests.post(url, data=data, verify='/path/to/public_key.pem')

Method 2

The easiest is to export the variable REQUESTS_CA_BUNDLE that points to your private certificate authority, or a specific certificate bundle. On the command line you can do that as follows:

export REQUESTS_CA_BUNDLE=/path/to/your/certificate.pem
python script.py

If you have your certificate authority and you don’t want to type the export each time you can add the REQUESTS_CA_BUNDLE to your ~/.bash_profile as follows:

echo "export REQUESTS_CA_BUNDLE=/path/to/your/certificate.pem" >> ~/.bash_profile ; source ~/.bash_profile

Conclusion

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

Also, Read