astronomer.providers.http.hooks.http

Module Contents

Classes

HttpHookAsync

Interact with HTTP servers using Python Async.

class astronomer.providers.http.hooks.http.HttpHookAsync(method='POST', http_conn_id=default_conn_name, auth_type=aiohttp.BasicAuth, retry_limit=3, retry_delay=1.0)[source]

Bases: airflow.hooks.base.BaseHook

Interact with HTTP servers using Python Async.

Parameters:
  • method (str) – the API method to be called

  • http_conn_id (str) – http connection id 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.

  • auth_type (AuthBase of python aiohttp lib) – The auth type for the service

conn_name_attr = 'http_conn_id'
default_conn_name = 'http_default'
conn_type = 'http'
hook_name = 'HTTP'
async run(endpoint=None, data=None, headers=None, extra_options=None)[source]

Performs an asynchronous HTTP request call

Parameters:
  • endpoint (Optional[str]) – the endpoint to be called i.e. resource/v1/query?

  • data (Optional[Union[Dict[str, Any], str]]) – payload to be uploaded or request parameters

  • headers (Optional[Dict[str, Any]]) – additional headers to be passed through as a dictionary

  • extra_options (Optional[Dict[str, Any]]) – Additional kwargs to pass when creating a request. For example, run(json=obj) is passed as aiohttp.ClientSession().get(json=obj)