airflow.providers.http.operators.http

Module Contents

Classes

SimpleHttpOperator

Calls an endpoint on an HTTP system to execute an action

class airflow.providers.http.operators.http.SimpleHttpOperator(*, endpoint=None, method='POST', data=None, headers=None, response_check=None, response_filter=None, extra_options=None, http_conn_id='http_default', log_response=False, auth_type=HTTPBasicAuth, tcp_keep_alive=True, tcp_keep_alive_idle=120, tcp_keep_alive_count=20, tcp_keep_alive_interval=30, **kwargs)[source]

Bases: airflow.models.BaseOperator

Calls an endpoint on an HTTP system to execute an action

See also

For more information on how to use this operator, take a look at the guide: SimpleHttpOperator

Parameters
  • http_conn_id (str) – The http connection to run the operator against

  • endpoint (str | None) – The relative part of the full url. (templated)

  • method (str) – The HTTP method to use, default = “POST”

  • data (Any) – The data to pass. POST-data in POST/PUT and params in the URL for a GET request. (templated)

  • headers (dict[str, str] | None) – The HTTP headers to be added to the GET request

  • response_check (Callable[..., bool] | None) – A check against the ‘requests’ response object. The callable takes the response object as the first positional argument and optionally any number of keyword arguments available in the context dictionary. It should return True for ‘pass’ and False otherwise.

  • response_filter (Callable[..., Any] | None) – A function allowing you to manipulate the response text. e.g response_filter=lambda response: json.loads(response.text). The callable takes the response object as the first positional argument and optionally any number of keyword arguments available in the context dictionary.

  • extra_options (dict[str, Any] | None) – Extra options for the ‘requests’ library, see the ‘requests’ documentation (options to modify timeout, ssl, etc.)

  • log_response (bool) – Log the response (default: False)

  • auth_type (type[requests.auth.AuthBase]) – The auth type for the service

  • tcp_keep_alive (bool) – Enable TCP Keep Alive for the connection.

  • tcp_keep_alive_idle (int) – The TCP Keep Alive Idle parameter (corresponds to socket.TCP_KEEPIDLE).

  • tcp_keep_alive_count (int) – The TCP Keep Alive count parameter (corresponds to socket.TCP_KEEPCNT)

  • tcp_keep_alive_interval (int) – The TCP Keep Alive interval parameter (corresponds to socket.TCP_KEEPINTVL)

template_fields: Sequence[str] = ('endpoint', 'data', 'headers')[source]
template_fields_renderers[source]
template_ext: Sequence[str] = ()[source]
ui_color = '#f4a460'[source]
execute(context)[source]

This is the main method to derive when creating an operator. Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

Was this entry helpful?