From the documentation:

requests can also ignore verifying the SSL certificate if you set verify to False.

>>> requests.get('https://kennethreitz.com', verify=False)
<Response [200]>

If you're using a third-party module and want to disable the checks, here's a context manager that monkey patches requests and changes it so that verify=False is the default and suppresses the warning.

import warnings
import contextlib

import requests
from urllib3.exceptions import InsecureRequestWarning

old_merge_environment_settings = requests.Session.merge_environment_settings

@contextlib.contextmanager
def no_ssl_verification():
    opened_adapters = set()

    def merge_environment_settings(self, url, proxies, stream, verify, cert):
        # Verification happens only once per connection so we need to close
        # all the opened adapters once we're done. Otherwise, the effects of
        # verify=False persist beyond the end of this context manager.
        opened_adapters.add(self.get_adapter(url))

        settings = old_merge_environment_settings(self, url, proxies, stream, verify, cert)
        settings['verify'] = False

        return settings

    requests.Session.merge_environment_settings = merge_environment_settings

    try:
        with warnings.catch_warnings():
            warnings.simplefilter('ignore', InsecureRequestWarning)
            yield
    finally:
        requests.Session.merge_environment_settings = old_merge_environment_settings

        for adapter in opened_adapters:
            try:
                adapter.close()
            except:
                pass

Here's how you use it:

with no_ssl_verification():
    requests.get('https://wrong.host.badssl.example/')
    print('It works')

    requests.get('https://wrong.host.badssl.example/', verify=True)
    print('Even if you try to force it to')

requests.get('https://wrong.host.badssl.example/', verify=False)
print('It resets back')

session = requests.Session()
session.verify = True

with no_ssl_verification():
    session.get('https://wrong.host.badssl.example/', verify=True)
    print('Works even here')

try:
    requests.get('https://wrong.host.badssl.example/')
except requests.exceptions.SSLError:
    print('It breaks')

try:
    session.get('https://wrong.host.badssl.example/')
except requests.exceptions.SSLError:
    print('It breaks here again')

Note that this code closes all open adapters that handled a patched request once you leave the context manager. This is because requests maintains a per-session connection pool and certificate validation happens only once per connection so unexpected things like this will happen:

>>> import requests
>>> session = requests.Session()
>>> session.get('https://wrong.host.badssl.example/', verify=False)
/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py:857: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
<Response [200]>
>>> session.get('https://wrong.host.badssl.example/', verify=True)
/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py:857: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
<Response [200]>
Answer from Blender on Stack Overflow
Top answer
1 of 15
923

From the documentation:

requests can also ignore verifying the SSL certificate if you set verify to False.

>>> requests.get('https://kennethreitz.com', verify=False)
<Response [200]>

If you're using a third-party module and want to disable the checks, here's a context manager that monkey patches requests and changes it so that verify=False is the default and suppresses the warning.

import warnings
import contextlib

import requests
from urllib3.exceptions import InsecureRequestWarning

old_merge_environment_settings = requests.Session.merge_environment_settings

@contextlib.contextmanager
def no_ssl_verification():
    opened_adapters = set()

    def merge_environment_settings(self, url, proxies, stream, verify, cert):
        # Verification happens only once per connection so we need to close
        # all the opened adapters once we're done. Otherwise, the effects of
        # verify=False persist beyond the end of this context manager.
        opened_adapters.add(self.get_adapter(url))

        settings = old_merge_environment_settings(self, url, proxies, stream, verify, cert)
        settings['verify'] = False

        return settings

    requests.Session.merge_environment_settings = merge_environment_settings

    try:
        with warnings.catch_warnings():
            warnings.simplefilter('ignore', InsecureRequestWarning)
            yield
    finally:
        requests.Session.merge_environment_settings = old_merge_environment_settings

        for adapter in opened_adapters:
            try:
                adapter.close()
            except:
                pass

Here's how you use it:

with no_ssl_verification():
    requests.get('https://wrong.host.badssl.example/')
    print('It works')

    requests.get('https://wrong.host.badssl.example/', verify=True)
    print('Even if you try to force it to')

requests.get('https://wrong.host.badssl.example/', verify=False)
print('It resets back')

session = requests.Session()
session.verify = True

with no_ssl_verification():
    session.get('https://wrong.host.badssl.example/', verify=True)
    print('Works even here')

try:
    requests.get('https://wrong.host.badssl.example/')
except requests.exceptions.SSLError:
    print('It breaks')

try:
    session.get('https://wrong.host.badssl.example/')
except requests.exceptions.SSLError:
    print('It breaks here again')

Note that this code closes all open adapters that handled a patched request once you leave the context manager. This is because requests maintains a per-session connection pool and certificate validation happens only once per connection so unexpected things like this will happen:

>>> import requests
>>> session = requests.Session()
>>> session.get('https://wrong.host.badssl.example/', verify=False)
/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py:857: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
<Response [200]>
>>> session.get('https://wrong.host.badssl.example/', verify=True)
/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py:857: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
<Response [200]>
2 of 15
219

Use requests.packages.urllib3.disable_warnings() and verify=False on requests methods.

Note that you can either import urllib3 directly or import it from requests.packages.urllib3 to be sure to use the same version as the one in requests.

import requests

import urllib3
# or if this does not work with the previous import:
# from requests.packages import urllib3  

# Suppress only the single warning from urllib3.
urllib3.disable_warnings(category=urllib3.exceptions.InsecureRequestWarning)

# Set `verify=False` on `requests.post`.
requests.post(url='https://example.com', data={'bar':'baz'}, verify=False)

And if you want to suppress the warning from urllib3 only when used by the requests methods, you can use it in a context manager:

with urllib3.warnings.catch_warnings():
   urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

   requests.post(url='https://example.com', data={'bar':'baz'}, verify=False)
🌐
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)
Discussions

SSL Verify in other modules that use requests (not using requests myself)
https://stackoverflow.com/questions/15445981/how-do-i-disable-the-security-certificate-check-in-python-requests More on reddit.com
🌐 r/learnpython
1
0
May 31, 2023
Python requests whit SSL verification deactivated
My question is about the security implications of this. Am I under any security risks if I'm just getting something (and not sending anything) from a website and not checking the TLS certificate? By telling the Python library to ignore SSL certificate verification, you are essentially accepting any SSL certificate the website may present, which can be invalid, self-signed, or expired. Unless you know the website and the actual cause of the SSL certificate validation failure, I would not trust anything you get from that website. The only time I'd disable verification is when the certificate has expired recently, which can happen even to legitimate websites where the admins have neglected to renew the certs. Other than that, I would not trust anything. What this means is, if you are under a MitM attack, you may think you are communicating with example.com, but you are actually talking to evil.com pretending to be example.com, and you have disabled the one mechanism that helps you know the difference. More on reddit.com
🌐 r/privacy
1
0
November 27, 2024
ssl - Python Requests throwing "SSLError" - Stack Overflow
After modified "requests.sessi... "/usr/local/lib/python2.6/dist-packages/dotcloud/client/client.py", it worked. 2013-02-15T10:33:16.767Z+00:00 ... This isn't marked as correct, but I can verify that it works (as opposed to the answers below). 2013-02-25T01:13:59.427Z+00:00 ... @khalid13: An axe "works" as a headache medicine (no head - no headache). It doesn't mean that it is a good idea to use it that way. verify=False disables host's SSL certificate ... More on stackoverflow.com
🌐 stackoverflow.com
Setting verify to False not ignore the SSL
I am trying to get bypass SSL by passing verify=False but it still try to validate SSL. conn = U4VConn( username=username, password=password, server_ip=address, port='8443', verify=False, array_id=array_id) conn.common.get_uni_version() The GET request to URL https://X.X.X.X:8443/univmax/r... More on github.com
🌐 github.com
23
April 21, 2021
🌐
GitHub
github.com › psf › requests › issues › 6669
Failed to ignore the SSL certificate verification when using `verify=False` option · Issue #6669 · psf/requests
March 23, 2024 - Requests is not ignoring the SSL certificate verification when using the verify=False option. ... $ curl -k https://website <html> <head><title>301 Moved Permanently</title></head> <body> <center><h1>301 Moved Permanently</h1></center> <hr><center>nginx/1.20.1</center> </body> </html> ... >> import requests >> requests.get("https://website", verify=False) Traceback (most recent call last): File "/home/vscode/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 467, in _make_request self._validate_conn(conn) File "/home/vscode/.local/lib/python3.10/site-packages/urllib3/connecti
Author   urbanogilson
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-disable-security-certificate-checks-for-requests-in-python
How to disable security certificate checks for requests in Python - GeeksforGeeks
July 23, 2025 - Explanation: By passing verify=False to the request method we disabled the security certificate check and made the program error-free to execute. But this approach will throw warnings as shown in the output picture.
🌐
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)
🌐
ScrapeOps
scrapeops.io › home › python web scraping playbook › python requests fix ssl error
Fix SSL Errors in Python Requests | ScrapeOps
May 5, 2024 - While both formats contain the ... convert it to PEM before using it. One easy way to bypass the error is by setting the SSL verification to false....
🌐
ScrapingAnt
scrapingant.com › blog › requests-ignore-ssl
How to Ignore SSL Certificate in Python Requests Library | ScrapingAnt
August 16, 2024 - One of the simplest methods to ignore SSL certificate errors in Python's requests library is to disable SSL verification globally. This can be achieved by setting the verify parameter to False when making requests.
Find elsewhere
🌐
Reddit
reddit.com › r/learnpython › ssl verify in other modules that use requests (not using requests myself)
r/learnpython on Reddit: SSL Verify in other modules that use requests (not using requests myself)
May 31, 2023 -

Hello,
I'm trying to set up python on a Windows computer to run some scripts to migrate from an old PBX server. We have our own internal PKI and the certs are in the wincertstore. The pbx uses our certs (although for the API, it might use it's own signed cert). Either way, since it's going away, I don't really want to fix certs on it. I'd rather have python ignore these errors just to get through an intern being able to use it to pull some data, migrate users, and be done with this thing.
I'm using the ciscoaxl module which in turn relies on requests. I've read a ton of posts about how to ignore SSL certs when using requests, but how can I do that when it's just another module calling (ciscoaxl) calling requets? I think my best bet is an environment variable but I cannot find one other than to point it at a CA bundle (and not totally clear how to make that in windows).
Either way, is there a way I can pass verify=False in to the ciscoaxl module for requests to then ignore it? Is there an env var I can set to do it globally? Or do I basically need to pull the module's source and update the code for my own use?

🌐
Jonathan Cutrer
jcutrer.com › home › python requests: how to ignore invalid ssl certificates
python requests: How to ignore invalid SSL certificates - jcutrer.com
September 17, 2021 - Or “` requests.get(‘https://example.com’, verify=True, cert=[‘/path/ca.crt’]) “` ... Actually, this is very useful. My app had to talk to a server that has an invalid SSL certificated and there was nothing I could do to fix it. I had to add “verify=false” to the code and after that only warnings remained.
🌐
HayaGeek
hayageek.com › home › disable ssl verification in python – requests, urllib3
Disable SSL Verification in Python - requests, urllib3
February 7, 2024 - The requests library is a popular, higher-level HTTP library. Disabling SSL verification within requests is straightforward using the verify parameter. import requests response = requests.get("https://example.com", verify=False) print(response.text)
🌐
ProxiesAPI
proxiesapi.com › articles › expert-techniques-for-disabling-ssl-certificate-verification-in-python-requests
Expert Techniques for Disabling SSL Certificate Verification in Python Requests | ProxiesAPI
The most straightforward way to disable SSL certificate verification is per request via the ... This disables verification only for this request, keeping all others verified. ... Simple and targeted. ... Can lead to repetitive code when making many requests. Risk of forgetting it and allowing an insecure request. So this method works in a pinch, but we can do better... ... import requests session = requests.Session() session.verify = False response = session.get('<https://invalid-ssl.com>')
🌐
TutorialsPoint
tutorialspoint.com › requests › requests_ssl_certification.htm
Requests - SSL Certification
import requests getdata = requests.get('https://jsonplaceholder.typicode.com/users', verify=False) print(getdata.text) You will get the output, but it will also give a warning message that, the SSL certificate is not verified and adding certificate verification is advised. E:\prequests>python makeRequest.py connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made.
🌐
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.
🌐
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 - Another method to resolve the Python requests SSL certificate_verify_failed error is by using the requests library in Python and disabling SSL verification by changing the “verify” parameter to False.
🌐
Reddit
reddit.com › r/privacy › python requests whit ssl verification deactivated
r/privacy on Reddit: Python requests whit SSL verification deactivated
November 27, 2024 -

Hello! I'm accessing some html on a public website through python script using the requests library. I got an error and found out that a way to solve it was by not checking the server's TLS certificate. On python's requests library you do this by setting the verify parameter to False:

html = requests.get(url=my_url, verify=False).text

My question is about the security implications of this. Am I under any security risks if I'm just getting something (and not sending anything) from a website and not checking the TLS certificate? I do not understand TLS encryption so any help would be welcomed, thanks!

🌐
ProxiesAPI
proxiesapi.com › articles › making-http-requests-in-python-without-ssl-verification
Making HTTP Requests in Python Without SSL Verification | ProxiesAPI
Here are a few methods to make Python requests without SSL verification. You can disable SSL verification for a requests session by setting ... import requests session = requests.Session() session.verify = False response = session.get("https://example.com")
🌐
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 - 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. The error protects you from man-in-the-middle attacks, but legitimate sites sometimes trigger false positives. Python relies on a certificate authority (CA) bundle to verify website identities.
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

🌐
Python Requests
python-requests.org › home › news › python requests ignore ssl: a comprehensive guide
Python Requests Ignore SSL: A Comprehensive Guide -
November 13, 2025 - – verify=True is the default behavior. – Setting verify=False bypasses SSL verification.
🌐
GitHub
github.com › dell › PyU4V › issues › 125
Setting verify to False not ignore the SSL · Issue #125 · dell/PyU4V
April 21, 2021 - I am trying to get bypass SSL by passing verify=False but it still try to validate SSL. conn = U4VConn( username=username, password=password, server_ip=address, port='8443', verify=False, array_id=array_id) conn.common.get_uni_version() The GET request to URL https://X.X.X.X:8443/univmax/r...
Author   lafada