Skip to content

Commit

Permalink
fix: Move telemetry urllib3 context to initialize function (#263)
Browse files Browse the repository at this point in the history
Signed-off-by: Caden Marofke <marofke@amazon.com>
  • Loading branch information
marofke committed Mar 29, 2024
1 parent ea1e617 commit aebd13b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/deadline/client/api/_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit aebd13b

Please sign in to comment.