Skip to content

Commit

Permalink
Error on verify as str. (#3418)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchristie authored Nov 28, 2024
1 parent 47f4a96 commit ce7e14d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions httpx/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ def create_ssl_context(verify: ssl.SSLContext | bool = True) -> ssl.SSLContext:
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
return ssl_context
elif isinstance(verify, str): # pragma: nocover
# Explicitly handle this deprecated usage pattern.
msg = (
"verify should be a boolean or SSLContext, since version 0.28. "
"Use `verify=ssl.create_default_context(cafile=...)` "
"or `verify=ssl.create_default_context(capath=...)`."
)
raise RuntimeError(msg)

return verify

Expand Down

0 comments on commit ce7e14d

Please sign in to comment.