httpx verify=False not working: 4 causes (tested)
Pass verify=False to httpx.Client() (per-request is a TypeError). If you also pass transport= or mounts=, set verify=False on that HTTPTransport: the client's setting does not reach it.
Use verify=False only against test servers you control: it disables certificate checks, so anyone in the network path can impersonate the server. When it seems to have no effect, it is almost always one of the cases below. Measured with httpx 0.28.1 on Python 3.13.5 against a local hypercorn server with a self-signed certificate (srv.start() returns its https URL).
1. verify goes on the Client, not on client.get()
import httpx, srv
url, _ = srv.start()
with httpx.Client() as c:
try:
c.get(url, verify=False)
except TypeError as e:
print("TypeError:", e)
with httpx.Client(verify=False) as c:
print("Client(verify=False):", c.get(url).status_code)
print("httpx.get(verify=False):", httpx.get(url, verify=False).status_code)
Output:
TypeError: Client.get() got an unexpected keyword argument 'verify'
Client(verify=False): 200
httpx.get(verify=False): 200
The module-level httpx.get() accepts verify= because it builds a client per call. On a Client, TLS settings are fixed at construction, so per-request verify= is a TypeError.
2. httpx verify=False not working with a custom transport
import httpx, srv
url, _ = srv.start()
with httpx.Client(verify=False, transport=httpx.HTTPTransport(retries=2)) as c:
try:
c.get(url)
except httpx.ConnectError as e:
print("ConnectError:", e)
with httpx.Client(transport=httpx.HTTPTransport(retries=2, verify=False)) as c:
print("verify=False on the transport:", c.get(url).status_code)
Output:
ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate (_ssl.c:1029)
verify=False on the transport: 200
When you pass transport= (for example to get retries), the client's own verify is not applied to it; the transport uses its own default (verify on). Put verify=False on httpx.HTTPTransport(...) instead.
3. verify="False" is a file path
import httpx, srv
url, _ = srv.start()
for v in ["False", "false"]:
try:
httpx.Client(verify=v)
except Exception as e:
print(f"verify={v!r}: {type(e).__name__}: {e}")
Output:
verify='False': FileNotFoundError: [Errno 2] No such file or directory
verify='false': FileNotFoundError: [Errno 2] No such file or directory
A string is treated as a CA bundle path, so a value read from an environment variable or config file fails with FileNotFoundError. Convert it to a real boolean first, e.g. os.environ.get("VERIFY", "1") not in ("0", "false", "False").
4. No warning is printed
import warnings, httpx, srv
url, _ = srv.start()
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
httpx.get(url, verify=False)
print("warnings from httpx verify=False:", [str(x.message) for x in w])
Output:
warnings from httpx verify=False: []
httpx emitted no warning for an unverified request in this test, so nothing in the logs tells you verification is off. Search your code for verify=False before shipping.
5. AsyncClient verify=False, and mounts=
import asyncio, httpx, srv
url, _ = srv.start()
async def main():
async with httpx.AsyncClient(verify=False) as c:
print("AsyncClient(verify=False):", (await c.get(url)).status_code)
async with httpx.AsyncClient(verify=False, mounts={"https://": httpx.AsyncHTTPTransport()}) as c:
try:
await c.get(url)
except httpx.ConnectError as e:
print("with mounts= transport:", type(e).__name__)
asyncio.run(main())
Output:
AsyncClient(verify=False): 200
with mounts= transport: ConnectError
AsyncClient(verify=False) works the same way. Transports passed in mounts= also ignore the client setting; give them verify=False (or, better, an SSLContext that trusts your CA, see httpx CERTIFICATE_VERIFY_FAILED).
Related: httpx SSL CERTIFICATE_VERIFY_FAILED fix, httpx retries transport, httpx proxy and mounts, httpx vs requests differences.
Frequently asked questions
Why is httpx verify=False not working?
Usually because a custom transport= or mounts= transport is used; those ignore the client's verify. Set verify=False on httpx.HTTPTransport(...).
Can I pass verify=False to client.get()?
No. In httpx 0.28.1 Client.get() raises TypeError: unexpected keyword argument 'verify'. Set it on the Client.
Does httpx warn when verify=False?
No warning was emitted in the test with httpx 0.28.1.
Written with AI assistance. Measured on 2026-10-23 with httpx 0.28.1 on Python 3.13.5 against a local HTTPS server with a self-signed certificate. Each block was run verbatim and the output pasted unedited. PlainHeaders is our extension; httpx is free.