class_docstr: Interact with HTTP servers.
  
  :param method: the API method to be called
  :param http_conn_id: :ref:`http connection<howto/connection:http>` that has the base
      API url i.e https://www.google.com/ and optional authentication credentials. Default
      headers can also be specified in the Extra field in json format.
  :param auth_type: The auth type for the service
  :param tcp_keep_alive: Enable TCP Keep Alive for the connection.
  :param tcp_keep_alive_idle: The TCP Keep Alive Idle parameter (corresponds to ``socket.TCP_KEEPIDLE``).
  :param tcp_keep_alive_count: The TCP Keep Alive count parameter (corresponds to ``socket.TCP_KEEPCNT``)
  :param tcp_keep_alive_interval: The TCP Keep Alive interval parameter (corresponds to
      ``socket.TCP_KEEPINTVL``)
  :param auth_args: extra arguments used to initialize the auth_type if different than default HTTPBasicAuth
class_docstr_tok: ["Interact","with","HTTP","servers",".",":","param","method",":","the","API","method","to","be","called",":","param","http_conn_id",":",":","ref",":","`","http","connection","<","howto\/connection",":","http",">","`","that","has","the","base","API","url","i.e","https",":","\/\/www.google.com\/","and","optional","authentication","credentials",".","Default","headers","can","also","be","specified","in","the","Extra","field","in","json","format",".",":","param","auth_type",":","The","auth","type","for","the","service",":","param","tcp_keep_alive",":","Enable","TCP","Keep","Alive","for","the","connection",".",":","param","tcp_keep_alive_idle",":","The","TCP","Keep","Alive","Idle","parameter","(","corresponds","to","``","socket.TCP_KEEPIDLE","``",")",".",":","param","tcp_keep_alive_count",":","The","TCP","Keep","Alive","count","parameter","(","corresponds","to","``","socket.TCP_KEEPCNT","``",")",":","param","tcp_keep_alive_interval",":","The","TCP","Keep","Alive","interval","parameter","(","corresponds","to","``","socket.TCP_KEEPINTVL","``",")",":","param","auth_args",":","extra","arguments","used","to","initialize","the","auth_type","if","different","than","default","HTTPBasicAuth"]
docstr: Create a Requests HTTP session.
  
  :param headers: additional headers to be passed through as a dictionary
docstr_tok: ["Create","a","Requests","HTTP","session",".",":","param","headers",":","additional","headers","to","be","passed","through","as","a","dictionary"]
code: def get_conn(
      self, headers: dict[Any, Any] | None = None
  ) -> requests.Session:
      """Create a Requests HTTP session.
  
      :param headers: additional headers to be passed through as a dictionary
      """
      session = requests.Session()
  
      if self.http_conn_id:
          conn = self.get_connection(self.http_conn_id)
  
          if conn.host and "://" in conn.host:
              self.base_url = conn.host
          else:
              # schema defaults to HTTP
              schema = conn.schema if conn.schema else "http"
              host = conn.host if conn.host else ""
              self.base_url = f"{schema}://{host}"
  
          if conn.port:
              self.base_url += f":{conn.port}"
          if conn.login:
              session.auth = self.auth_type(conn.login, conn.password)
          elif self._auth_type:
              session.auth = self.auth_type()
          if conn.extra:
              extra = conn.extra_dejson
              extra.pop(
                  "timeout", None
              )  # ignore this as timeout is only accepted in request method of Session
              extra.pop(
                  "allow_redirects", None
              )  # ignore this as only max_redirects is accepted in Session
              session.proxies = extra.pop(
                  "proxies", extra.pop("proxy", {})
              )
              session.stream = extra.pop("stream", False)
              session.verify = extra.pop(
                  "verify", extra.pop("verify_ssl", True)
              )
              session.cert = extra.pop("cert", None)
              session.max_redirects = extra.pop(
                  "max_redirects", DEFAULT_REDIRECT_LIMIT
              )
  
              try:
                  session.headers.update(extra)
              except TypeError:
                  self.log.warning(
                      "Connection to %s has invalid extra field.",
                      conn.host,
                  )
      if headers:
          session.headers.update(headers)
  
      return session
  
imports: from __future__ import annotations
  import asyncio
  from typing import TYPE_CHECKING, Any, Callable
  import aiohttp
  import requests
  import tenacity
  from aiohttp import ClientResponseError
  from asgiref.sync import sync_to_async
  from requests.auth import HTTPBasicAuth
  from requests.models import DEFAULT_REDIRECT_LIMIT
  from requests_toolbelt.adapters.socket_options import TCPKeepAliveAdapter
  from airflow.exceptions import AirflowException
  from airflow.hooks.base import BaseHook
label_desc: Use image node_id 4 for calling the HttpHook obj's underlying member method code with example usage: obj.get_conn(headers) and returns: session