class_docstr: A wrapper class around the requests library which handles chores like logging, retries, and timeouts
  automatically.
class_docstr_tok: ["A","wrapper","class","around","the","requests","library","which","handles","chores","like","logging",",","retries",",","and","timeouts","automatically","."]
code: def __init__(
      self,
      base_url: str,
      auth_token: Optional[str] = None,
      log_callback: Optional[Callable] = None,
  ) -> None:
      self.base_url = base_url
      retry_strategy = Retry(
          # wait time between retries increases exponentially according to: backoff_factor * (2 ** (retry - 1))
          # but the the maximum wait time is 120 secs. By setting a large value (2880), we'll make sure clients
          # are going to be alive for a very long time (~ 4 days) but retries every 120 seconds
          total=_CONNECTION_RETRY_TOTAL,
          backoff_factor=_CONNECTION_RETRY_BACKOFF_FACTOR,
          status_forcelist=[
              408,  # Request Timeout
              429,  # Too Many Requests
              500,  # Internal Server Error
              502,  # Bad Gateway
              503,  # Service Unavailable
              504,  # Gateway Timeout
          ],
      )
      adapter = CustomRetryAdapter(
          max_retries=retry_strategy, timeout=_DEFAULT_REQUEST_TIMEOUT
      )
      self.session = requests.Session()
  
      self.session.hooks = {"response": _response}
  
      self.session.mount("http://", adapter)
      self.session.mount("https://", adapter)
  
      if auth_token:
          self.session.headers.update(
              {"Authorization": f"Bearer {auth_token}"}
          )
  
      self.log_function = log_callback or self.log_function
  
imports: import socket
  from functools import wraps
  from typing import Any, Callable, Dict, Optional
  from urllib.parse import urljoin
  import requests
  from lightning_cloud.rest_client import GridRestClient, LightningClient, create_swagger_client
  from requests import Session
  from requests.adapters import HTTPAdapter
  from requests.exceptions import ConnectionError, ConnectTimeout, ReadTimeout
  from urllib3.util.retry import Retry
  from lightning.app.core import constants
  from lightning.app.utilities.app_helpers import Logger
label_desc: Use image node_id 1 to create a new HTTPClient object  with example: obj = HTTPClient(base_url, auth_token, log_callback)