class_docstr: Hook for Apache Livy through the REST API.
  
  :param livy_conn_id: reference to a pre-defined Livy Connection.
  :param extra_options: A dictionary of options passed to Livy.
  :param extra_headers: A dictionary of headers passed to the HTTP request to livy.
  :param auth_type: The auth type for the service.
  
  .. seealso::
      For more details refer to the Apache Livy API reference:
      https://livy.apache.org/docs/latest/rest-api.html
class_docstr_tok: ["Hook","for","Apache","Livy","through","the","REST","API",".",":","param","livy_conn_id",":","reference","to","a","pre-defined","Livy","Connection",".",":","param","extra_options",":","A","dictionary","of","options","passed","to","Livy",".",":","param","extra_headers",":","A","dictionary","of","headers","passed","to","the","HTTP","request","to","livy",".",":","param","auth_type",":","The","auth","type","for","the","service",".","..","seealso",":",":","For","more","details","refer","to","the","Apache","Livy","API","reference",":","https",":","\/\/livy.apache.org\/docs\/latest\/rest-api.html"]
docstr: Wrap HttpHook; allows to change method on the same HttpHook.
  
  :param method: http method
  :param endpoint: endpoint
  :param data: request payload
  :param headers: headers
  :param retry_args: Arguments which define the retry behaviour.
      See Tenacity documentation at https://github.com/jd/tenacity
  :return: http response
docstr_tok: ["Wrap","HttpHook",";","allows","to","change","method","on","the","same","HttpHook",".",":","param","method",":","http","method",":","param","endpoint",":","endpoint",":","param","data",":","request","payload",":","param","headers",":","headers",":","param","retry_args",":","Arguments","which","define","the","retry","behaviour",".","See","Tenacity","documentation","at","https",":","\/\/github.com\/jd\/tenacity",":","return",":","http","response"]
code: def run_method(
      self,
      endpoint: str,
      method: str = "GET",
      data: Any | None = None,
      headers: dict[str, Any] | None = None,
      retry_args: dict[str, Any] | None = None,
  ) -> Any:
      """
      Wrap HttpHook; allows to change method on the same HttpHook.
  
      :param method: http method
      :param endpoint: endpoint
      :param data: request payload
      :param headers: headers
      :param retry_args: Arguments which define the retry behaviour.
          See Tenacity documentation at https://github.com/jd/tenacity
      :return: http response
      """
      if method not in ("GET", "POST", "PUT", "DELETE", "HEAD"):
          raise ValueError(f"Invalid http method '{method}'")
      if not self.extra_options:
          self.extra_options = {"check_response": False}
  
      back_method = self.method
      self.method = method
      try:
          if retry_args:
              result = self.run_with_advanced_retry(
                  endpoint=endpoint,
                  data=data,
                  headers=headers,
                  extra_options=self.extra_options,
                  _retry_args=retry_args,
              )
          else:
              result = self.run(
                  endpoint, data, headers, self.extra_options
              )
  
      finally:
          self.method = back_method
      return result
  
imports: from __future__ import annotations
  import asyncio
  import json
  import re
  from enum import Enum
  from typing import TYPE_CHECKING, Any, Sequence
  import aiohttp
  import requests
  from aiohttp import ClientResponseError
  from asgiref.sync import sync_to_async
  from airflow.exceptions import AirflowException
  from airflow.providers.http.hooks.http import HttpAsyncHook, HttpHook
  from airflow.utils.log.logging_mixin import LoggingMixin
label_desc: Use image node_id 3 for calling the LivyHook obj's underlying member method code with example usage: obj.run_method(endpoint, method, data, headers, retry_args) and returns: result