Skip to content

Commit ce7e14d

Browse files
authored
Error on verify as str. (#3418)
1 parent 47f4a96 commit ce7e14d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

httpx/_config.py

+8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ def create_ssl_context(verify: ssl.SSLContext | bool = True) -> ssl.SSLContext:
3131
ssl_context.check_hostname = False
3232
ssl_context.verify_mode = ssl.CERT_NONE
3333
return ssl_context
34+
elif isinstance(verify, str): # pragma: nocover
35+
# Explicitly handle this deprecated usage pattern.
36+
msg = (
37+
"verify should be a boolean or SSLContext, since version 0.28. "
38+
"Use `verify=ssl.create_default_context(cafile=...)` "
39+
"or `verify=ssl.create_default_context(capath=...)`."
40+
)
41+
raise RuntimeError(msg)
3442

3543
return verify
3644

0 commit comments

Comments
 (0)