diff --git a/backend/whatsapp.py b/backend/whatsapp.py index 293e157..6e1e61a 100644 --- a/backend/whatsapp.py +++ b/backend/whatsapp.py @@ -18,13 +18,16 @@ logger = logging.getLogger(__name__) async def create_http_client() -> httpx.AsyncClient: """ Create an httpx client with proper certificate verification. - Uses certifi for CA bundle and creates proper SSL context for handshake. + Uses certifi for CA bundle with minimal SSL configuration for compatibility. """ - # Create SSL context with proper certificate verification + # Create SSL context with certifi's CA bundle ssl_context = ssl.create_default_context(cafile=certifi.where()) - ssl_context.minimum_version = ssl.TLSVersion.TLSv1_2 - ssl_context.maximum_version = ssl.TLSVersion.TLSv1_3 - ssl_context.options |= ssl.OP_NO_COMPRESSION + # Ensure TLS 1.2+ but allow server to negotiate the version + try: + ssl_context.minimum_version = ssl.TLSVersion.TLSv1_2 + except AttributeError: + # Older Python versions - just use defaults + pass return httpx.AsyncClient( verify=ssl_context,