airflow.operators.http_operator

Module Contents

class airflow.operators.http_operator.SimpleHttpOperator(endpoint, method='POST', data=None, headers=None, response_check=None, extra_options=None, xcom_push=False, http_conn_id='http_default', log_response=False, *args, **kwargs)[source]

Bases: airflow.models.BaseOperator

Calls an endpoint on an HTTP system to execute an action

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. Returns True for ‘pass’ and False otherwise.

  • 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.)

  • xcom_push (bool) – Push the response to Xcom (default: False). If xcom_push is True, response of an HTTP request will also be pushed to an XCom.

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

template_fields = ['endpoint', 'data', 'headers'][source]
template_ext = [][source]
ui_color = #f4a460[source]
execute(self, context)[source]

Was this entry helpful?