From f399c7e9942f2efea57ae2cb51f040216b96776a Mon Sep 17 00:00:00 2001 From: Carolin Dohmen Date: Thu, 10 Jan 2019 15:07:15 +0100 Subject: [PATCH] Add option to specify client certificate --- sentry_sdk/consts.py | 1 + sentry_sdk/transport.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index e35307d0d2..e57adfbb06 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -28,6 +28,7 @@ "debug": False, "attach_stacktrace": False, "ca_certs": None, + "cert_file": None, } diff --git a/sentry_sdk/transport.py b/sentry_sdk/transport.py index d93868b8fb..d0fa2dea69 100644 --- a/sentry_sdk/transport.py +++ b/sentry_sdk/transport.py @@ -18,7 +18,7 @@ from urllib import getproxies -def _make_pool(parsed_dsn, http_proxy, https_proxy, ca_certs): +def _make_pool(parsed_dsn, http_proxy, https_proxy, ca_certs, cert_file): # Use http_proxy if scheme is https and https_proxy is not set proxy = parsed_dsn.scheme == "https" and https_proxy or http_proxy if not proxy: @@ -28,6 +28,7 @@ def _make_pool(parsed_dsn, http_proxy, https_proxy, ca_certs): "num_pools": 2, "cert_reqs": "CERT_REQUIRED", "ca_certs": ca_certs or certifi.where(), + "cert_file": cert_file, } if proxy: @@ -95,6 +96,7 @@ def __init__(self, options): http_proxy=options["http_proxy"], https_proxy=options["https_proxy"], ca_certs=options["ca_certs"], + cert_file=options["cert_file"], ) self._disabled_until = None self._retry = urllib3.util.Retry()