Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Move telemetry urllib context to initialize function #263

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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