Open source video conferencing app powered by LiveKit. Built with Django and React.
🩹(backend) replace requests exception with urllib3 ones
lebaudantoine61aa3c79c5b1
diff --git a/src/backend/core/services/marketing.py b/src/backend/core/services/marketing.pyindex 88439c96..554e740c 100644--- a/src/backend/core/services/marketing.py+++ b/src/backend/core/services/marketing.py@@ -10,7 +10,7 @@ from django.core.exceptions import ImproperlyConfiguredfrom django.utils.module_loading import import_stringimport brevo_python-import requests+import urllib3logger = logging.getLogger(__name__)@@ -121,7 +121,10 @@ class BrevoMarketingService:try:response = contact_api.create_contact(contact, **api_configurations)- except (brevo_python.rest.ApiException, requests.exceptions.ReadTimeout) as err:+ except (+ brevo_python.rest.ApiException,+ urllib3.exceptions.ReadTimeoutError,+ ) as err:logger.warning("Failed to create contact in Brevo", exc_info=True)raise ContactCreationError("Failed to create contact in Brevo") from errdiff --git a/src/backend/core/tests/services/test_marketing.py b/src/backend/core/tests/services/test_marketing.pyindex ac1b31a4..2b0686d1 100644--- a/src/backend/core/tests/services/test_marketing.py+++ b/src/backend/core/tests/services/test_marketing.py@@ -11,7 +11,7 @@ from django.core.exceptions import ImproperlyConfiguredimport brevo_pythonimport pytest-import requests+import urllib3from core.services.marketing import (BrevoMarketingService,@@ -152,7 +152,11 @@ def test_create_contact_timeout_error(mock_contact_api):brevo_service = BrevoMarketingService()- mock_api.create_contact.side_effect = requests.exceptions.ReadTimeout()+ mock_api.create_contact.side_effect = urllib3.exceptions.ReadTimeoutError(+ pool=mock.Mock(),+ url="https://api.brevo.com/v3/endpoint",+ message="HTTPSConnectionPool(host='api.brevo.com', port=443): Read timed out.",+ )with pytest.raises(ContactCreationError, match="Failed to create contact in Brevo"):brevo_service.create_contact(valid_contact_data)