airflow.providers.http.operators.http

Module Contents

class airflow.providers.http.operators.http.SimpleHttpOperator(*, endpoint: Optional[str] = None, method: str = 'POST', data: Any = None, headers: Optional[Dict[str, str]] = None, response_check: Optional[Callable[..., bool]] = None, response_filter: Optional[Callable[..., Any]] = None, extra_options: Optional[Dict[str, Any]] = None, http_conn_id: str = 'http_default', log_response: bool = False, **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 connection to run the operator against

  • endpoint (str) -- The relative part of the full url. (templated)

  • method (str) -- The HTTP method to use, default = "POST"

  • data (For POST/PUT, depends on the content-type parameter, for GET a dictionary of key/value string pairs) -- The data to pass. POST-data in POST/PUT and params in the URL for a GET request. (templated)

  • headers (a dictionary of string key/value pairs) -- The HTTP headers to be added to the GET request

  • response_check (A lambda or defined function.) -- 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 (A lambda or defined function.) -- 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 (A dictionary of options, where key is string and value depends on the option that's being modified.) -- Extra options for the 'requests' library, see the 'requests' documentation (options to modify timeout, ssl, etc.)

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

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

Was this entry helpful?