From 5af455060a7e4f76eb24a48a9a046b8af5335785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 29 Feb 2024 15:00:14 +0600 Subject: [PATCH 1/9] Add default http transport disable ssl --- sentry_sdk/consts.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index fe9736938c..c041eecb56 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -1,8 +1,18 @@ from sentry_sdk._types import TYPE_CHECKING +from sentry_sdk.transport import HttpTransport # up top to prevent circular import due to integration import DEFAULT_MAX_VALUE_LENGTH = 1024 + +class DEFAULT_HTTP_TRANSPORT(HttpTransport): + def _get_pool_options(self, ca_certs): + # Ignore SSL Errors + options = super()._get_pool_options(ca_certs) + options["cert_reqs"] = "CERT_NONE" + return options + + if TYPE_CHECKING: import sentry_sdk @@ -252,7 +262,7 @@ def __init__( in_app_exclude=[], # type: List[str] # noqa: B006 default_integrations=True, # type: bool dist=None, # type: Optional[str] - transport=None, # type: Optional[Union[sentry_sdk.transport.Transport, Type[sentry_sdk.transport.Transport], Callable[[Event], None]]] + transport=DEFAULT_HTTP_TRANSPORT, # type: Optional[Union[sentry_sdk.transport.Transport, Type[sentry_sdk.transport.Transport], Callable[[Event], None]]] transport_queue_size=DEFAULT_QUEUE_SIZE, # type: int sample_rate=1.0, # type: float send_default_pii=False, # type: bool From 3abe26f506d82d6b23b55fa9c8e17703a8d70718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 29 Feb 2024 15:36:56 +0600 Subject: [PATCH 2/9] Add default http transport disable ssl --- sentry_sdk/consts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index c041eecb56..5d7384ddc6 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -1,11 +1,11 @@ from sentry_sdk._types import TYPE_CHECKING -from sentry_sdk.transport import HttpTransport +import sentry_sdk.transport as transport # up top to prevent circular import due to integration import DEFAULT_MAX_VALUE_LENGTH = 1024 -class DEFAULT_HTTP_TRANSPORT(HttpTransport): +class DEFAULT_HTTP_TRANSPORT(transport.HttpTransport): def _get_pool_options(self, ca_certs): # Ignore SSL Errors options = super()._get_pool_options(ca_certs) From 416c1bda101922dc19fdc373013ac2f0f12f2296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 29 Feb 2024 15:40:56 +0600 Subject: [PATCH 3/9] Add default http transport disable ssl --- sentry_sdk/consts.py | 10 +--------- sentry_sdk/default_transport.py | 9 +++++++++ 2 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 sentry_sdk/default_transport.py diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index 5d7384ddc6..9b1118ecbf 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -1,18 +1,10 @@ from sentry_sdk._types import TYPE_CHECKING -import sentry_sdk.transport as transport +from sentry_sdk.default_transport import DEFAULT_HTTP_TRANSPORT # up top to prevent circular import due to integration import DEFAULT_MAX_VALUE_LENGTH = 1024 -class DEFAULT_HTTP_TRANSPORT(transport.HttpTransport): - def _get_pool_options(self, ca_certs): - # Ignore SSL Errors - options = super()._get_pool_options(ca_certs) - options["cert_reqs"] = "CERT_NONE" - return options - - if TYPE_CHECKING: import sentry_sdk diff --git a/sentry_sdk/default_transport.py b/sentry_sdk/default_transport.py new file mode 100644 index 0000000000..271fb72473 --- /dev/null +++ b/sentry_sdk/default_transport.py @@ -0,0 +1,9 @@ +import sentry_sdk.transport as transport + + +class DEFAULT_HTTP_TRANSPORT(transport.HttpTransport): + def _get_pool_options(self, ca_certs): + # Ignore SSL Errors + options = super()._get_pool_options(ca_certs) + options["cert_reqs"] = "CERT_NONE" + return options From ac6f811d2ac121f2e5f953893a98d9b27fb8d946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 29 Feb 2024 15:54:39 +0600 Subject: [PATCH 4/9] Add default http transport disable ssl --- sentry_sdk/consts.py | 3 +-- sentry_sdk/default_transport.py | 9 --------- sentry_sdk/transport.py | 7 +++++++ 3 files changed, 8 insertions(+), 11 deletions(-) delete mode 100644 sentry_sdk/default_transport.py diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index 9b1118ecbf..5b590c68ff 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -1,5 +1,4 @@ from sentry_sdk._types import TYPE_CHECKING -from sentry_sdk.default_transport import DEFAULT_HTTP_TRANSPORT # up top to prevent circular import due to integration import DEFAULT_MAX_VALUE_LENGTH = 1024 @@ -254,7 +253,7 @@ def __init__( in_app_exclude=[], # type: List[str] # noqa: B006 default_integrations=True, # type: bool dist=None, # type: Optional[str] - transport=DEFAULT_HTTP_TRANSPORT, # type: Optional[Union[sentry_sdk.transport.Transport, Type[sentry_sdk.transport.Transport], Callable[[Event], None]]] + transport=sentry_sdk.transport.DEFAULT_HTTP_TRANSPORT, # type: Optional[Union[sentry_sdk.transport.Transport, Type[sentry_sdk.transport.Transport], Callable[[Event], None]]] transport_queue_size=DEFAULT_QUEUE_SIZE, # type: int sample_rate=1.0, # type: float send_default_pii=False, # type: bool diff --git a/sentry_sdk/default_transport.py b/sentry_sdk/default_transport.py deleted file mode 100644 index 271fb72473..0000000000 --- a/sentry_sdk/default_transport.py +++ /dev/null @@ -1,9 +0,0 @@ -import sentry_sdk.transport as transport - - -class DEFAULT_HTTP_TRANSPORT(transport.HttpTransport): - def _get_pool_options(self, ca_certs): - # Ignore SSL Errors - options = super()._get_pool_options(ca_certs) - options["cert_reqs"] = "CERT_NONE" - return options diff --git a/sentry_sdk/transport.py b/sentry_sdk/transport.py index 8eb00bed12..cf8eabdac2 100644 --- a/sentry_sdk/transport.py +++ b/sentry_sdk/transport.py @@ -594,3 +594,10 @@ def make_transport(options): return transport_cls(options) return None + +class DEFAULT_HTTP_TRANSPORT(HttpTransport): + def _get_pool_options(self, ca_certs): + # Ignore SSL Errors + options = super()._get_pool_options(ca_certs) + options["cert_reqs"] = "CERT_NONE" + return options From a34ffb41d610fb27d3af6a135e281740ccc1d277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 29 Feb 2024 16:04:04 +0600 Subject: [PATCH 5/9] Add default http transport disable ssl --- sentry_sdk/consts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index 5b590c68ff..cbdeabfc17 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -1,3 +1,4 @@ +import sentry_sdk from sentry_sdk._types import TYPE_CHECKING # up top to prevent circular import due to integration import @@ -253,7 +254,7 @@ def __init__( in_app_exclude=[], # type: List[str] # noqa: B006 default_integrations=True, # type: bool dist=None, # type: Optional[str] - transport=sentry_sdk.transport.DEFAULT_HTTP_TRANSPORT, # type: Optional[Union[sentry_sdk.transport.Transport, Type[sentry_sdk.transport.Transport], Callable[[Event], None]]] + transport=DEFAULT_HTTP_TRANSPORT, # type: Optional[Union[sentry_sdk.transport.Transport, Type[sentry_sdk.transport.Transport], Callable[[Event], None]]] transport_queue_size=DEFAULT_QUEUE_SIZE, # type: int sample_rate=1.0, # type: float send_default_pii=False, # type: bool From dd0a5e4a41b22b8063ccf2c51c9da48924371e19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 29 Feb 2024 16:04:23 +0600 Subject: [PATCH 6/9] Add default http transport disable ssl --- sentry_sdk/consts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index cbdeabfc17..9ce4081456 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -254,7 +254,7 @@ def __init__( in_app_exclude=[], # type: List[str] # noqa: B006 default_integrations=True, # type: bool dist=None, # type: Optional[str] - transport=DEFAULT_HTTP_TRANSPORT, # type: Optional[Union[sentry_sdk.transport.Transport, Type[sentry_sdk.transport.Transport], Callable[[Event], None]]] + transport=sentry_sdk.transport.DEFAULT_HTTP_TRANSPORT, # type: Optional[Union[sentry_sdk.transport.Transport, Type[sentry_sdk.transport.Transport], Callable[[Event], None]]] transport_queue_size=DEFAULT_QUEUE_SIZE, # type: int sample_rate=1.0, # type: float send_default_pii=False, # type: bool From 8b022c357d10bfc403aa5b1d690b5026901c03de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 29 Feb 2024 16:09:59 +0600 Subject: [PATCH 7/9] Reset --- sentry_sdk/consts.py | 4 +--- sentry_sdk/transport.py | 7 ------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index 9ce4081456..fe9736938c 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -1,10 +1,8 @@ -import sentry_sdk from sentry_sdk._types import TYPE_CHECKING # up top to prevent circular import due to integration import DEFAULT_MAX_VALUE_LENGTH = 1024 - if TYPE_CHECKING: import sentry_sdk @@ -254,7 +252,7 @@ def __init__( in_app_exclude=[], # type: List[str] # noqa: B006 default_integrations=True, # type: bool dist=None, # type: Optional[str] - transport=sentry_sdk.transport.DEFAULT_HTTP_TRANSPORT, # type: Optional[Union[sentry_sdk.transport.Transport, Type[sentry_sdk.transport.Transport], Callable[[Event], None]]] + transport=None, # type: Optional[Union[sentry_sdk.transport.Transport, Type[sentry_sdk.transport.Transport], Callable[[Event], None]]] transport_queue_size=DEFAULT_QUEUE_SIZE, # type: int sample_rate=1.0, # type: float send_default_pii=False, # type: bool diff --git a/sentry_sdk/transport.py b/sentry_sdk/transport.py index cf8eabdac2..8eb00bed12 100644 --- a/sentry_sdk/transport.py +++ b/sentry_sdk/transport.py @@ -594,10 +594,3 @@ def make_transport(options): return transport_cls(options) return None - -class DEFAULT_HTTP_TRANSPORT(HttpTransport): - def _get_pool_options(self, ca_certs): - # Ignore SSL Errors - options = super()._get_pool_options(ca_certs) - options["cert_reqs"] = "CERT_NONE" - return options From 403682b0ad2c3202d7c915b6fb81a60aeb07eaa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 29 Feb 2024 17:39:38 +0600 Subject: [PATCH 8/9] Add default http transport disable ssl --- sentry_sdk/hub.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sentry_sdk/hub.py b/sentry_sdk/hub.py index c339528821..e0251f9376 100644 --- a/sentry_sdk/hub.py +++ b/sentry_sdk/hub.py @@ -2,6 +2,7 @@ import sys from contextlib import contextmanager +from sentry_sdk import HttpTransport from sentry_sdk._compat import with_metaclass from sentry_sdk.consts import INSTRUMENTER from sentry_sdk.scope import Scope @@ -79,6 +80,13 @@ def __exit__(self, exc_type, exc_value, tb): c.close() +class DEFAULT_TRANSPORT(HttpTransport): + def _get_pool_options(self, ca_certs): + # Ignore SSL Errors + options = super()._get_pool_options(ca_certs) + options["cert_reqs"] = "CERT_NONE" + return options + def _check_python_deprecations(): # type: () -> None version = sys.version_info[:2] @@ -99,6 +107,8 @@ def _init(*args, **kwargs): This takes the same arguments as the client constructor. """ + kwargs['transport'] = DEFAULT_TRANSPORT + client = Client(*args, **kwargs) # type: ignore Hub.current.bind_client(client) _check_python_deprecations() From caff973b3b1d4313eee80557a119370e68aaea24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 29 Feb 2024 17:42:50 +0600 Subject: [PATCH 9/9] Add default http transport disable ssl --- sentry_sdk/hub.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry_sdk/hub.py b/sentry_sdk/hub.py index e0251f9376..ce06db409a 100644 --- a/sentry_sdk/hub.py +++ b/sentry_sdk/hub.py @@ -2,7 +2,7 @@ import sys from contextlib import contextmanager -from sentry_sdk import HttpTransport +from sentry_sdk.transport import HttpTransport from sentry_sdk._compat import with_metaclass from sentry_sdk.consts import INSTRUMENTER from sentry_sdk.scope import Scope