import certifi
from .__version__ import __version__
-from .utils import get_ca_bundle_from_env
+from .utils import get_ca_bundle_from_env, get_logger
CertTypes = typing.Union[str, typing.Tuple[str, str], typing.Tuple[str, str, str]]
VerifyTypes = typing.Union[str, bool, ssl.SSLContext]
)
+logger = get_logger(__name__)
+
+
class SSLConfig:
"""
SSL Configuration.
) -> ssl.SSLContext:
http_versions = HTTPVersionConfig() if http_versions is None else http_versions
+ logger.debug(
+ f"load_ssl_context "
+ f"verify={self.verify!r} "
+ f"cert={self.cert!r} "
+ f"trust_env={self.trust_env!r} "
+ f"http_versions={http_versions!r}"
+ )
+
if self.ssl_context is None:
self.ssl_context = (
self.load_ssl_context_verify(http_versions=http_versions)
pass
if ca_bundle_path.is_file():
+ logger.debug(f"load_verify_locations cafile={ca_bundle_path!s}")
context.load_verify_locations(cafile=str(ca_bundle_path))
elif ca_bundle_path.is_dir():
+ logger.debug(f"load_verify_locations capath={ca_bundle_path!s}")
context.load_verify_locations(capath=str(ca_bundle_path))
self._load_client_certs(context)