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, **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 (Optional[str]) -- 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 (Optional[Dict[str, str]]) -- The HTTP headers to be added to the GET request

  • response_check (Optional[Callable[Ellipsis, bool]]) -- 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 (Optional[Callable[Ellipsis, Any]]) -- 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 (Optional[Dict[str, Any]]) -- 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

template_fields :Sequence[str] = ['endpoint', 'data', 'headers'][source]
template_fields_renderers[source]
template_ext :Sequence[str] = [][source]
ui_color = #f4a460[source]
execute(self, 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?