--- contrib/python/httpx/httpx/_config.py (499810bf8a30b39c38d23cdf60c243417fdf81ee) +++ contrib/python/httpx/httpx/_config.py (2e6e05a77528bac894ef025fa9cc552ac6cd0751) @@ -56,7 +56,11 @@ class SSLConfig: SSL Configuration. """ - DEFAULT_CA_BUNDLE_PATH = Path(certifi.where()) + DEFAULT_CA_BUNDLE_PATH = certifi.where() + if callable(DEFAULT_CA_BUNDLE_PATH): + DEFAULT_CA_BUNDLE_PATH = staticmethod(DEFAULT_CA_BUNDLE_PATH) + else: + DEFAULT_CA_BUNDLE_PATH = Path(DEFAULT_CA_BUNDLE_PATH) def __init__( self, @@ -137,7 +141,10 @@ class SSLConfig: except AttributeError: # pragma: nocover pass - if ca_bundle_path.is_file(): + if callable(ca_bundle_path): + logger.debug("load_verify_locations cafile=%r", ca_bundle_path) + context.load_verify_locations(cafile=ca_bundle_path) + elif ca_bundle_path.is_file(): cafile = str(ca_bundle_path) logger.debug("load_verify_locations cafile=%r", cafile) context.load_verify_locations(cafile=cafile)