From edc8cdaa76c57fe256fdc8486d830fb5194c6390 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Wed, 14 Nov 2018 14:58:23 +0100 Subject: [PATCH] feat: ca_certs option --- sentry_sdk/consts.py | 1 + sentry_sdk/transport.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index 54ecfbbb3e..55aa3ecace 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -27,6 +27,7 @@ "before_breadcrumb": None, "debug": False, "attach_stacktrace": False, + "ca_certs": None, } diff --git a/sentry_sdk/transport.py b/sentry_sdk/transport.py index 25d28063eb..1268db2e1c 100644 --- a/sentry_sdk/transport.py +++ b/sentry_sdk/transport.py @@ -18,12 +18,16 @@ from urllib import getproxies -def _make_pool(parsed_dsn, http_proxy, https_proxy): +def _make_pool(parsed_dsn, http_proxy, https_proxy, ca_certs): proxy = https_proxy if parsed_dsn == "https" else http_proxy if not proxy: proxy = getproxies().get(parsed_dsn.scheme) - opts = {"num_pools": 2, "cert_reqs": "CERT_REQUIRED", "ca_certs": certifi.where()} + opts = { + "num_pools": 2, + "cert_reqs": "CERT_REQUIRED", + "ca_certs": ca_certs or certifi.where(), + } if proxy: return urllib3.ProxyManager(proxy, **opts) @@ -89,6 +93,7 @@ def __init__(self, options): self.parsed_dsn, http_proxy=options["http_proxy"], https_proxy=options["https_proxy"], + ca_certs=options["ca_certs"], ) self._disabled_until = None self._retry = urllib3.util.Retry()