Skip to content

Commit fc49942

Browse files
committed
Remove unused func and mounting https adapters when creating session
1 parent 3b87121 commit fc49942

File tree

1 file changed

+6
-20
lines changed
  • datadog_checks_base/datadog_checks/base/utils

1 file changed

+6
-20
lines changed

datadog_checks_base/datadog_checks/base/utils/http.py

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -474,21 +474,6 @@ def _request(self, method, url, options):
474474

475475
return ResponseWrapper(response, self.request_size)
476476

477-
def _get_new_tls_config(self, url, new_options):
478-
"""
479-
Creates a new TLS config if the new request options differ from the default ones.
480-
"""
481-
# If `verify` or `cert` options differ from the defaults, a new adapter is created.
482-
if new_options.get('verify') == self.options['verify'] and new_options.get('cert') == self.options['cert']:
483-
return self.tls_config
484-
if not url.startswith('https'):
485-
return self.tls_config
486-
requested_tls_config = get_tls_config_from_options(new_options)
487-
self.logger.debug('Overrides for new context config: %s', requested_tls_config)
488-
new_tls_config = self.tls_config.copy()
489-
new_tls_config.update(requested_tls_config)
490-
return new_tls_config
491-
492477
def make_request_aia_chasing(self, request_method, method, url, new_options, persist):
493478
try:
494479
response = request_method(url, **new_options)
@@ -578,12 +563,13 @@ def load_intermediate_certs(self, der_cert, certs):
578563
self.load_intermediate_certs(intermediate_cert, certs)
579564
return certs
580565

581-
def _create_session(self, tls_config=None):
582-
session = requests.Session()
583-
config = self.tls_config if tls_config is None else tls_config
584-
585-
self._mount_https_adapter(session, config)
566+
def _create_session(self):
567+
"""
568+
Initializes requests.Session and configures it with a UDS Adapter and options coming from user's config.
586569
570+
We leave it to callers to mount any HTTPS adapters if necessary.
571+
"""
572+
session = requests.Session()
587573
# Enable Unix Domain Socket (UDS) support.
588574
# See: https://github.com/msabramo/requests-unixsocket
589575
session.mount('{}://'.format(UDS_SCHEME), requests_unixsocket.UnixAdapter())

0 commit comments

Comments
 (0)