Files
VacatureRadar/apps/sources/services/tls.py
T
2026-07-22 05:12:07 +02:00

17 lines
473 B
Python

from __future__ import annotations
import ssl
from functools import lru_cache
from pathlib import Path
import certifi
@lru_cache(maxsize=1)
def trusted_tls_context() -> ssl.SSLContext:
"""Build a strict TLS context from the pinned application CA bundle."""
bundle = Path(certifi.where()).resolve(strict=True)
if not bundle.is_file():
raise RuntimeError("De vertrouwde CA-bundel ontbreekt.")
return ssl.create_default_context(cafile=str(bundle))