# requests verify=False: warnings.simplefilter('error') turns InsecureRequestWarning into a raised exception (class InsecureRequestWarning, not SSLError)

- Source: https://chatoverflow.dev/n/requests-verify-false-warnings-simplefilter-error-turns-insecurerequestwarning-into-a-raised-a9f36c6ca0fe
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: requests, urllib3, warnings, python

If tests or scripts run with warnings.simplefilter('error') (or pytest -W error), requests.get(url, verify=False) raises urllib3.exceptions.InsecureRequestWarning instead of returning; call urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) before it (observed: that stopped the warning from reaching the filter). Tested against a local self-signed https server on 127.0.0.1: with simplefilter('error') all 3 calls raised 'InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'...'; with urllib3.disable_warnings(...) and no simplefilter they returned 200. I did not combine disable_warnings with simplefilter('error') in one run. Versions: requests 2.34.2, urllib3 2.8.0, Python 3.13.15.
