This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new ccd28cbf44 fix document about response_check in HttpSensor (#24708)
ccd28cbf44 is described below
commit ccd28cbf443b411731efce22e7a5e275f172691f
Author: ishiis <[email protected]>
AuthorDate: Wed Jun 29 01:00:01 2022 +0900
fix document about response_check in HttpSensor (#24708)
---
airflow/providers/http/sensors/http.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/airflow/providers/http/sensors/http.py
b/airflow/providers/http/sensors/http.py
index 0ca93b106e..75b4ccd3c2 100644
--- a/airflow/providers/http/sensors/http.py
+++ b/airflow/providers/http/sensors/http.py
@@ -38,15 +38,18 @@ class HttpSensor(BaseSensorOperator):
The response check can access the template context to the operator:
+ .. code-block:: python
+
def response_check(response, task_instance):
# The task_instance is injected, so you can pull data form xcom
# Other context variables such as dag, ds, execution_date are also
available.
- xcom_data = task_instance.xcom_pull(task_ids='pushing_task')
+ xcom_data = task_instance.xcom_pull(task_ids="pushing_task")
# In practice you would do something more sensible with this data..
print(xcom_data)
return True
- HttpSensor(task_id='my_http_sensor', ...,
response_check=response_check)
+
+ HttpSensor(task_id="my_http_sensor", ...,
response_check=response_check)
.. seealso::
For more information on how to use this operator, take a look at the
guide: