Skip to content
Prev Previous commit
Next Next commit
Rename default SSLContext to make it private by convention
  • Loading branch information
agubelu committed May 7, 2024
commit f21e70bf7a3430f219de00557817d23bfdd62dbd
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