From fd7eb50d290d25dcb7727b5b5f4a8e3f8dac45e8 Mon Sep 17 00:00:00 2001 From: Caden Marofke Date: Fri, 29 Mar 2024 16:42:10 -0500 Subject: [PATCH] fix: Move telemetry urllib3 context to initialize function Signed-off-by: Caden Marofke --- src/deadline/client/api/_telemetry.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/deadline/client/api/_telemetry.py b/src/deadline/client/api/_telemetry.py index 8bfb744bf..41ad946f4 100644 --- a/src/deadline/client/api/_telemetry.py +++ b/src/deadline/client/api/_telemetry.py @@ -9,7 +9,6 @@ import random import time -from botocore.httpsession import create_urllib3_context, get_cert_path from configparser import ConfigParser from dataclasses import asdict, dataclass, field from datetime import datetime @@ -92,9 +91,6 @@ def __init__( self._initialized: bool = False self.package_name = package_name self.package_ver = ".".join(package_ver.split(".")[:3]) - # Some environments might not have SSL, so we'll use the vendored botocore SSL context - self._urllib3_context = create_urllib3_context() - self._urllib3_context.load_verify_locations(cafile=get_cert_path(True)) # IDs for this session self.session_id: str = str(uuid.uuid4()) @@ -139,6 +135,11 @@ def initialize(self, config: Optional[ConfigParser] = None) -> None: f"{get_deadline_endpoint_url(config=config)}/2023-10-12/telemetry", TelemetryClient.ENDPOINT_PREFIX, ) + # Some environments might not have SSL, so we'll use the vendored botocore SSL context + from botocore.httpsession import create_urllib3_context, get_cert_path + + self._urllib3_context = create_urllib3_context() + self._urllib3_context.load_verify_locations(cafile=get_cert_path(True)) user_id, _ = get_user_and_identity_store_id(config=config) if user_id: