The problem you are having is caused by an untrusted SSL certificate.

Like dirk mentioned in a previous comment, the quickest fix is setting verify=False:

requests.get('https://example.com', verify=False)

Please note that this will cause the certificate not to be verified. This will expose your application to security risks, such as man-in-the-middle attacks.

Of course, apply judgment. As mentioned in the comments, this may be acceptable for quick/throwaway applications/scripts, but this should really not go to production software.

If just skipping the certificate check is not acceptable in your particular context, consider the following options, your best option is to set the verify parameter to a string that is the path of the .pem file of the certificate (which you should obtain by some sort of secure means).

So, as of version 2.0, the verify parameter accepts the following values, with their respective semantics:

  • True: causes the certificate to validated against the library's own trusted certificate authorities (Note: you can see which root certificates (RCs) Requests uses via the Certifi library, a trust database of RCs extracted from Requests: Certifi - Trust Database for Humans).

  • False: bypasses certificate validation completely.

  • Path to a CA_BUNDLE file for Requests to use to validate the certificates.

Source: Requests - SSL Cert Verification

Also take a look at the cert parameter on the same page.

Answer from Rafael Almeida on Stack Overflow
Top answer
1 of 16
723

The problem you are having is caused by an untrusted SSL certificate.

Like dirk mentioned in a previous comment, the quickest fix is setting verify=False:

requests.get('https://example.com', verify=False)

Please note that this will cause the certificate not to be verified. This will expose your application to security risks, such as man-in-the-middle attacks.

Of course, apply judgment. As mentioned in the comments, this may be acceptable for quick/throwaway applications/scripts, but this should really not go to production software.

If just skipping the certificate check is not acceptable in your particular context, consider the following options, your best option is to set the verify parameter to a string that is the path of the .pem file of the certificate (which you should obtain by some sort of secure means).

So, as of version 2.0, the verify parameter accepts the following values, with their respective semantics:

  • True: causes the certificate to validated against the library's own trusted certificate authorities (Note: you can see which root certificates (RCs) Requests uses via the Certifi library, a trust database of RCs extracted from Requests: Certifi - Trust Database for Humans).

  • False: bypasses certificate validation completely.

  • Path to a CA_BUNDLE file for Requests to use to validate the certificates.

Source: Requests - SSL Cert Verification

Also take a look at the cert parameter on the same page.

2 of 16
142

From Requests' documentation on SSL verification:

Requests can verify SSL certificates for HTTPS requests, just like a web browser. To check a host’s SSL certificate, you can use the verify argument (for example, interactively):

requests.get('https://kennethreitz.com', verify=True)

If you don't want to verify your SSL certificate, make verify=False

Discussions

SSL errors in python 3.13
Hi I am using a self signed certificate and, when using it in python 3.9, it works fine, but when using it with python 3.13, i have this error requests.exceptions.SSLError: HTTPSConnectionPool(host=‘XXX’, port=443): Ma… More on discuss.python.org
🌐 discuss.python.org
5
0
April 24, 2025
Python API SDK SSL: CERTIFICATE_VERIFY_FAILED Error
I am running into this error trying to connect smartsheet api via python sdk and getting this error on a mac book pro: smartsheet.exceptions.HttpError: (SSLError(MaxRetryError("HTTPSConnectionPool(host='api.smartsheet.com', port=443): Max retries exceeded with url: /2.0/sheets?pageSize=300... More on community.smartsheet.com
🌐 community.smartsheet.com
August 31, 2022
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain
Greeting, I am trying to connect to the OpenAI api from python. but have failed. I have searched the openAI api documentations and openAI dev forums. My openAI version is 1.14.3. I cannot use lower version to use assistant model import os from openai import OpenAI OPENAI_API_KEY = 'my-key' ... More on community.openai.com
🌐 community.openai.com
9
1
April 2, 2024
"SSL: CERTIFICATE_VERIFY_FAILED" error on Python 3.9.6 (Windows 10)
Hi! I’m new with Python and I have been following some tutorials and based on one of them I have the following piece of code: from scrapy import Selector from urllib.request import urlopen html = urlopen("https://www.… More on discuss.python.org
🌐 discuss.python.org
0
0
May 5, 2022
People also ask

What does CERTIFICATE_VERIFY_FAILED mean in Python?
The CERTIFICATE_VERIFY_FAILED error occurs when Python cannot validate an SSL/TLS certificate while making HTTPS requests. Your script fails because Python's SSL module blocks connections to websites with certificates it considers untrusted, expired, or improperly configured. This happens most frequently when using libraries like urllib, requests, or pip to fetch data from secure websites.
🌐
sslinsights.com
sslinsights.com › home › wiki › how to fix ssl certificate_verify_failed error in python
Fix Python SSL CERTIFICATE_VERIFY_FAILED Error in 2026
Does updating Python fix SSL certificate errors?
Updating Python often resolves certificate errors because newer versions include updated CA bundles and improved SSL handling. Python 3.10+ comes with better certificate management and automatic certifi integration. However, you may still need to run the post-installation certificate script on macOS or manually update certifi on older systems.
🌐
sslinsights.com
sslinsights.com › home › wiki › how to fix ssl certificate_verify_failed error in python
Fix Python SSL CERTIFICATE_VERIFY_FAILED Error in 2026
Why does Python reject valid SSL certificates?
Python relies on a certificate authority (CA) bundle to verify website identities. When this bundle becomes outdated or missing, Python flags even legitimate certificates as suspicious. Corporate networks create another common trigger where company firewalls intercept HTTPS traffic using self-signed certificates that Python doesn't recognize.
🌐
sslinsights.com
sslinsights.com › home › wiki › how to fix ssl certificate_verify_failed error in python
Fix Python SSL CERTIFICATE_VERIFY_FAILED Error in 2026
🌐
DEV Community
dev.to › toby-patrick › how-to-fix-ssl-certificateverifyfailed-in-python-requests-35nl
How to Fix “SSL: CERTIFICATE_VERIFY_FAILED” in Python Requests - DEV Community
September 15, 2025 - This error appears when your Python application fails to verify the SSL certificate of a website you’re trying to communicate with using HTTPS. It’s Python’s way of protecting your system from untrusted connections. ... requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)
🌐
SSLInsights
sslinsights.com › home › wiki › how to fix ssl certificate_verify_failed error in python
Fix Python SSL CERTIFICATE_VERIFY_FAILED Error in 2026
3 weeks ago - Install CA certificates in your Dockerfile using RUN apt-get update && apt-get install -y ca-certificates for Debian/Ubuntu images. Then install Python’s certifi package and set the REQUESTS_CA_BUNDLE environment variable to point to /etc/ssl/certs/ca-certificates.crt. This ensures your containerized Python applications can verify SSL certificates correctly.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-fix-python-requests-sslerror
How to Fix Python Requests SSLError? - GeeksforGeeks
July 23, 2025 - The requests library relies on the certifi package to verify SSL certificates.
Find elsewhere
🌐
Esri Community
community.esri.com › t5 › python-questions › solving-ssl-errors-in-python-requests › td-p › 1124005
Solving SSL Errors in Python Requests - Esri Community
February 12, 2025 - My machine could now perform a web request through Python without throwing an SSL error. If you're having this same issue, you can most likely do an uninstall of ArcGIS Pro, then make sure to delete the certificate in the location indicated by the requests.certs.where() function before re-installing pro.
🌐
ScrapeOps
scrapeops.io › home › python web scraping playbook › python requests fix ssl error
Fix SSL Errors in Python Requests | ScrapeOps
May 5, 2024 - This can happen due to misconfiguration or when the server's certificate is not issued for the hostname being accessed. When making HTTPS requests in your Python application, ensure that you're using the correct hostname in the URL.
🌐
Medium
bayinmin.medium.com › tutorial-6-fix-ssl-error-in-python-requests-when-proxying-through-burp-suite-0bd67d417663
Tutorial #6: Fix SSL Error in Python requests when proxying through Burp Suite | by Ba Yin Min | Medium
November 20, 2024 - tl;dr — Two ways to fix: either disable SSL checking completely with verify=False (the dirty approach) or use verify=<path to cert> to enforce certificate check against a chosen certificate from a desired local location.
🌐
Python.org
discuss.python.org › python help
SSL errors in python 3.13 - Python Help - Discussions on Python.org
April 24, 2025 - Hi I am using a self signed certificate and, when using it in python 3.9, it works fine, but when using it with python 3.13, i have this error requests.exceptions.SSLError: HTTPSConnectionPool(host=‘XXX’, port=443): Max retries exceeded with url: /XXX (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1028)’))) any idea what can i do to fix it?
🌐
Cheap SSL Web
cheapsslweb.com › home › how to fix “ssl: certificate_verify_failed” error in python?
Fix SSL: CERTIFICATE_VERIFY_FAILED Error in Python
December 8, 2025 - To resolve this error, one can create an SSL context without certificate verification and HTTPS, update the cert bundle using PIP, or use the requests module and set SSL verification to false.
🌐
Smartsheet Community
community.smartsheet.com › home › get help › api & developers
Python API SDK SSL: CERTIFICATE_VERIFY_FAILED Error - Smartsheet Community
August 31, 2022 - I am running into this error trying to connect smartsheet api via python sdk and getting this error on a mac book pro: smartsheet.exceptions.HttpError: (SSLError(MaxRetryError("HTTPSConnectionPool(host='api.smartsheet.com', port=443): Max retries exceeded with url: /2.0/sheets?pageSize=300&includeAll=False (Caused by…
🌐
ScrapingBee
scrapingbee.com › webscraping-questions › requests › how-to-fix-ssl-error-in-python-requests
How to fix SSLError in Python requests? | ScrapingBee
The easiest way to fix this issue is to disable SSL verification for that particular web address by passing in verify=False as an argument to the method calls. Just make sure you are not sending any ...
🌐
Python.org
discuss.python.org › python help
"SSL: CERTIFICATE_VERIFY_FAILED" error on Python 3.9.6 (Windows 10) - Python Help - Discussions on Python.org
May 5, 2022 - Hi! I’m new with Python and I have been following some tutorials and based on one of them I have the following piece of code: from scrapy import Selector from urllib.request import urlopen html = urlopen("https://www.pythonparatodos.com.br/formulario.html") sel = Selector(text = html.read()) lista = sel.xpath('//input[@type="text"]') print(lista) for selector in lista: print(selector) The URL is easily accessed through a browser but when I run the code I got the following errors: C:\Use...
🌐
Reddit
reddit.com › r/learnpython › error when using proxy with python requests library
r/learnpython on Reddit: Error when using proxy with python requests library
October 8, 2021 -

I'm getting an SSL error every time I make a request with a proxy. At first I thought the problem was SSL related, but i found some code than implements the proxy using urllib's build opener method and it works just fine. So I'm wondering how I can fix the error using requests library since I'm working on a big project that uses a requests session. BTW I'm using Luminati proxy manger.

My code for requests session:

sess = requests.session() 
sess.proxies.update({'http': 'http://127.0.0.1:24000',         
                     'https': 'http://127.0.0.1:24000'}) 
resp = sess.get('https://api.myip.com')

The error i get:

requests.exceptions.SSLError: HTTPSConnectionPool(host='api.myip.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)'))) 

The code i found online that works just fine:

from urllib import request  
opener = request.build_opener(
        request.ProxyHandler({'http': 'http://127.0.0.1:24000',                                              
                          'https': 'http://127.0.0.1:24000'}))
print(opener.open('https://api.myip.com').read()) 

Thank you in advance

🌐
Scrapfly
scrapfly.io › blog › answers › python-requests-exception-sllerror
How to fix Python requests SSLError? - Scrapfly Blog
4 weeks ago - The SSLError exception is rarely encountered in web scraping but the easiest way to fix it is to simply disable certification verification (verify=False parameter) if no sensitive data is being exchanged.
🌐
Microsoft Learn
learn.microsoft.com › en-gb › answers › questions › 2077926 › update-to-python-3-11-got-sslerror(sslcertverifica
Update to Python 3.11 got SSLError ...
It seems like your Python installation is not configured to trust any Certificate Authorities (CAs). This can happen when Python can't find the system's set of trusted CAs. In Python 3.11, there might be a change in how SSL certificates are ...
🌐
PISquare
pisquare.osisoft.com › s › question › 0D58W00007HOdwhSAD › secure-ways-to-avoid-ssl-local-issuer-certificate-issues-using-python-requests-and-pi-web-api
Secure ways to avoid SSL local issuer certificate issues using Python Requests and PI Web API. - Forum - PI Square - AVEVA Community
May 11, 2022 - The issue here is that `verify=False` is NOT something you should do in production, as this allows insecure requests to your API and makes your application vulnerable to Man-In-The-Middle attacks. I've tried some SSL certificate chaining by creating my own .pem file, which can work, but seems like a bit of work to do securely, especially since I am deploying this using a Docker container and Kubernetes cluster.