class_docstr: ClearML API Session class. 
class_docstr_tok: ["ClearML","API","Session","class","."]
code: def _connect(self):
      if self._offline_mode:
          return
  
      self._ssl_error_count_verbosity = self.config.get(
          "api.ssl_error_count_verbosity",
          self._ssl_error_count_verbosity,
      )
  
      self.__host = self.__init_host or self.get_api_server_host(
          config=self.config
      )
      if not self.__host:
          raise ValueError(
              "ClearML host was not set, check your configuration file or environment variable"
          )
      self.__host = self.__host.strip("/")
      self.__http_retries_config = (
          self.__init_http_retries_config
          or self.config.get(
              "api.http.retries", ConfigTree()
          ).as_plain_ordered_dict()
      )
  
      self.__http_retries_config[
          "status_forcelist"
      ] = self._get_retry_codes()
      self.__http_retries_config["config"] = self.config
      self.__http_session = get_http_session_with_retry(
          **self.__http_retries_config
      )
      self.__http_session.write_timeout = self._write_session_timeout
      self.__http_session.request_size_threshold = (
          self._write_session_data_size
      )
  
      self.__max_req_size = self.config.get(
          "api.http.max_req_size", None
      )
      if not self.__max_req_size:
          raise ValueError("missing max request size")
  
      token_expiration_threshold_sec = self.config.get(
          "auth.token_expiration_threshold_sec", 60
      )
      req_token_expiration_sec = self.config.get(
          "api.auth.req_token_expiration_sec", None
      )
      self.__auth_token = None
      self._update_default_api_method()
      if ENV_AUTH_TOKEN.get():
          self.__access_key = self.__secret_key = None
          self.__auth_token = ENV_AUTH_TOKEN.get()
          # if we use a token we override make sure we are at least 3600 seconds (1 hour)
          # away from the token expiration date, ask for a new one.
          token_expiration_threshold_sec = max(
              token_expiration_threshold_sec, 3600
          )
      else:
          self.__access_key = self.__init_api_key or ENV_ACCESS_KEY.get(
              default=(
                  self.config.get("api.credentials.access_key", None)
                  or self.default_key
              )
          )
          self.__secret_key = (
              self.__init_secret_key
              or ENV_SECRET_KEY.get(
                  default=(
                      self.config.get(
                          "api.credentials.secret_key", None
                      )
                      or self.default_secret
                  )
              )
          )
  
      if (
          not self.secret_key
          and not self.access_key
          and not self.__auth_token
      ):
          raise MissingConfigError()
  
      super(Session, self).__init__(
          **self.__token_manager_kwargs,
          token_expiration_threshold_sec=token_expiration_threshold_sec,
          req_token_expiration_sec=req_token_expiration_sec,
      )
      self.refresh_token()
  
      local_logger = self._LocalLogger(self._logger)
  
      # update api version from server response
      try:
          token_dict = TokenManager.get_decoded_token(self.token)
          api_version = token_dict.get("api_version")
          if not api_version:
              api_version = (
                  "2.2"
                  if token_dict.get("env", "") == "prod"
                  else Session.api_version
              )
          if token_dict.get("server_version"):
              self.add_client(
                  "clearml-server", token_dict.get("server_version")
              )
  
          Session.max_api_version = Session.api_version = str(
              api_version
          )
          Session.feature_set = str(
              token_dict.get("feature_set", self.feature_set) or "basic"
          )
      except (jwt.DecodeError, ValueError):
          local_logger().warning(
              "Failed parsing server API level, defaulting to {}".format(
                  Session.api_version
              )
          )
  
      # now setup the session reporting, so one consecutive retries will show warning
      # we do that here, so if we have problems authenticating, we see them immediately
      # notice: this is across the board warning omission
      urllib_log_warning_setup(
          total_retries=self.__http_retries_config.get("total", 0),
          display_warning_after=3,
      )
  
      if self.force_max_api_version and self.check_min_api_version(
          self.force_max_api_version
      ):
          Session.max_api_version = Session.api_version = str(
              self.force_max_api_version
          )
  
      # update only after we have max_api
      self.__class__._sessions_created += 1
  
      if self._load_vaults():
          from clearml.config import ConfigWrapper, ConfigSDKWrapper
  
          ConfigWrapper.set_config_impl(self.config)
          ConfigSDKWrapper.clear_config_impl()
  
      self._apply_config_sections(local_logger)
  
      self._update_default_api_method()
  
imports: from __future__ import print_function
  import json
  import logging
  import os
  import sys
  import types
  import weakref
  from socket import gethostname
  from time import sleep
  import jwt
  import requests
  import six
  from requests.auth import HTTPBasicAuth
  from requests.exceptions import ChunkedEncodingError, ContentDecodingError, StreamConsumedError
  from six.moves.urllib.parse import urlparse, urlunparse
  from typing import List, Optional
  from .callresult import CallResult
  from .defs import ENV_VERBOSE, ENV_HOST, ENV_ACCESS_KEY, ENV_SECRET_KEY, ENV_WEB_HOST, ENV_FILES_HOST, ENV_OFFLINE_MODE, ENV_AUTH_TOKEN, ENV_DISABLE_VAULT_SUPPORT, ENV_ENABLE_ENV_CONFIG_SECTION, ENV_ENABLE_FILES_CONFIG_SECTION, ENV_API_EXTRA_RETRY_CODES, ENV_API_DEFAULT_REQ_METHOD, ENV_FORCE_MAX_API_VERSION, ENV_IGNORE_MISSING_CONFIG, MissingConfigError
  from .request import Request, BatchRequest
  from .token_manager import TokenManager
  from ..utils import get_http_session_with_retry, urllib_log_warning_setup
  from ...backend_config import ConfigurationError
  from ...backend_config.defs import get_config_file
  from ...debugging import get_logger
  from ...debugging.log import resolve_logging_level
  from ...utilities.pyhocon import ConfigTree, ConfigFactory
  from ...version import __version__
  from ...backend_config.utils import apply_files, apply_environment
label_desc: Use image node_id 8 for calling the Session obj's underlying member method code with example usage: obj._connect() without return types