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

🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-fix-python-requests-sslerror
How to Fix Python Requests SSLError? - GeeksforGeeks
July 23, 2025 - SSLError in Python's requests library typically occurs due to issues related to SSL certificates. Here are some common reasons why this error might be triggered:
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
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] with python requests library
There was an error while loading. Please reload this page. ... import requests import urllib.request with urllib.request.urlopen('https://facebook.com/') as response: print(len(response.read())) print(len(requests.get('https://facebook.com').text)) ... 206922 --------------------------------------------------------------------------- SSLError Traceback (most recent call last) ~/Desktop/proj/.venv/lib/python3... More on github.com
🌐 github.com
8
August 29, 2017
SSL: CERTIFICATE_VERIFY_FAILED ( Windows )
It seems like you encountered an SSL certificate verification error while making an HTTP request. More on discuss.python.org
🌐 discuss.python.org
10
0
November 19, 2023
SSL verification error when using requests sessions
The problem When using requests sessions to connect to a https website with a self signed certificate, requests throws a SSLError. It is working pefectly fine when using requests without sessions. ... More on github.com
🌐 github.com
11
August 25, 2017
🌐
ScrapeOps
scrapeops.io › home › python web scraping playbook › python requests fix ssl error
Fix SSL Errors in Python Requests | ScrapeOps
May 5, 2024 - By setting the verify parameter to False, you instruct Python requests to skip SSL certificate verification. While this can quickly resolve SSL errors, it's important to note that it compromises the security of your application by allowing potential ...
🌐
ScrapingBee
scrapingbee.com › webscraping-questions › requests › how-to-fix-ssl-error-in-python-requests
How to fix SSLError in Python requests? | ScrapingBee
Here is some sample code that disables SSL verification: import requests response = requests.get("https://example.com/", verify=False) You can optionally provide a custom certificate for the website to fix this error as well. Here is some sample code for providing a custom .pem certificate file to requests: import requests custom_certificate_path = "./certificates/custom-certificate.pem" response = requests.get("https://example.com/", verify=custom_certificate_path) Are Python requests deprecated?
🌐
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 - So, knowing that ArcGIS Pro had already been reinstalled and it didn't help, the installer must not have replaced this file, it must have just checked it and moved on or appended data to it? Not sure there. Either way, I renamed the old one and put a copy of the cert found on the other machine after a new install and BAM! My machine could now perform a web request through Python without throwing an SSL error.
🌐
Scrapfly
scrapfly.io › blog › answers › python-requests-exception-sllerror
How to fix Python requests SSLError? - Scrapfly Blog
3 weeks ago - Python's requests.SSLError is caused when encryption certificates mismatch for HTTPS type of URLs. Here's how to fix it.
🌐
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?
Find elsewhere
🌐
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.
🌐
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)
🌐
GitHub
github.com › mitmproxy › mitmproxy › issues › 2547
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] with python requests library · Issue #2547 · mitmproxy/mitmproxy
August 29, 2017 - There was an error while loading. Please reload this page. ... import requests import urllib.request with urllib.request.urlopen('https://facebook.com/') as response: print(len(response.read())) print(len(requests.get('https://facebook.com').text)) ... 206922 --------------------------------------------------------------------------- SSLError Traceback (most recent call last) ~/Desktop/proj/.venv/lib/python3.6/site-packages/requests/packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, **respons
Author   nmiculinic
🌐
ProxiesAPI
proxiesapi.com › articles › how-to-fix-sslerror-in-python-requests
How to fix SSLError in Python requests | ProxiesAPI
Properly handle SSL errors in Python requests by updating CA bundles, fixing certificates, and using TLS 1.2+. Use SSLContext for full control over SSL behavior.
🌐
ScrapingAnt
scrapingant.com › blog › requests-ignore-ssl
How to Ignore SSL Certificate in Python Requests Library | ScrapingAnt
August 16, 2024 - A comprehensive guide on how to ignore SSL certificate errors in Python's Requests library, complete with code examples and best practices.
🌐
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 - The error can be caused due to an expired or invalid SSL certificate, issues with the SSL certificate chain, or obsolete Python default certificates. To resolve this error, one can create an SSL context without certificate verification and HTTPS, ...
🌐
GitHub
github.com › psf › requests › issues › 4256
SSL verification error when using requests sessions · Issue #4256 · psf/requests
August 25, 2017 - # Normal request import requests requests.get('https://kubernetes.default.svc') <Response [401]> # Session request s = requests.Session() request = requests.Request('GET', 'https://kubernetes.default.svc') prepared_request = s.prepare_request(request) response = s.send(prepared_request) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 612, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python2.7/site-packages/requests/adapters.py", line 504, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='kubernetes.default.svc', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)'),))
Author   PascalVA
🌐
SSLInsights
sslinsights.com › home › wiki › how to fix ssl certificate_verify_failed error in python
Fix Python SSL CERTIFICATE_VERIFY_FAILED Error in 2026
2 weeks ago - Python’s error messages use “SSL” for historical reasons, but the actual protocol is TLS 1.2 or 1.3. Both terms appear interchangeably in error messages and documentation. 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.
🌐
Bright Data
brightdata.com › faqs › python-requests › fix-sslerror
How to Fix SSLError in requests?
July 9, 2024 - Overcome SSLError in Python's requests: Opt for disabling SSL verification or secure with custom certificates. Enhance scraping with Bright Data's proxies and APIs.
🌐
PyXLL
support.pyxll.com › hc › en-gb › articles › 18949393753363--SSL-CERTIFICATE-VERIFY-FAILED-when-using-requests-and-https
[SSL: CERTIFICATE_VERIFY_FAILED] when using requests and https – PyXLL
The error happens because the certificate being used by the server was not issued by a certificate authority (CA) included in the default list of trusted CAs used by the requests module.
🌐
GitHub
github.com › psf › requests › issues › 6235
SSL error with requests 2.28.x: certificate verify failed: unable to get local issuer certificate · Issue #6235 · psf/requests
September 7, 2022 - (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)'))) ... { "chardet": { "version": null }, "charset_normalizer": { "version": "2.0.12" }, "cryptography": { "version": "" }, "idna": { "version": "3.3" }, "implementation": { "name": "CPython", "version": "3.9.10" }, "platform": { "release": "10", "system": "Windows" }, "pyOpenSSL": { "openssl_version": "", "version": null }, "requests": { "version": "2.28.1" }, "system_ssl": { "version": "101010df" }, "urllib3": { "version": "1.26.12" }, "using_charset_normalizer": true, "using_pyopenssl": false }
Author   fervand1