Skip to content

Commit

Permalink
Rename default SSLContext to make it private by convention
Browse files Browse the repository at this point in the history
  • Loading branch information
agubelu committed May 7, 2024
1 parent 8f95456 commit f21e70b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/requests/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ def SOCKSProxyManager(*args, **kwargs):
DEFAULT_POOLSIZE = 10
DEFAULT_RETRIES = 0
DEFAULT_POOL_TIMEOUT = None
DEFAULT_SSL_CONTEXT = create_urllib3_context()
DEFAULT_SSL_CONTEXT.load_verify_locations(extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH))

_preloaded_ssl_context = create_urllib3_context()
_preloaded_ssl_context.load_verify_locations(extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH))


def _urllib3_request_context(
Expand All @@ -89,7 +90,7 @@ def _urllib3_request_context(
if verify is False:
cert_reqs = "CERT_NONE"
elif verify is True:
pool_kwargs["ssl_context"] = DEFAULT_SSL_CONTEXT
pool_kwargs["ssl_context"] = _preloaded_ssl_context
elif isinstance(verify, str):
if not os.path.isdir(verify):
pool_kwargs["ca_certs"] = verify
Expand Down

0 comments on commit f21e70b

Please sign in to comment.