You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/04/27 17:33:25 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #8591: Add http system test

kaxil commented on a change in pull request #8591:
URL: https://github.com/apache/airflow/pull/8591#discussion_r416010413



##########
File path: docs/howto/operator/http/http.rst
##########
@@ -0,0 +1,77 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+HTTP Operators
+==============
+
+In all of the following code examples we are using the ``http_default`` connection which means we calling requests
+against `httpbin <https://www.httpbin.org/>`__ site to perform basic http operations.
+
+.. _howto/operator:HttpSensor:
+
+Use the :class:`~airflow.providers.http.sensors.http.HttpSensor` to poke until the ``response_check`` callable evaluates
+to ``true``.
+
+Here we are poking until httpbin gives us a response text containing ``httpbin``.
+
+.. exampleinclude:: ../../../airflow/providers/http/example_dags/example_http.py
+    :language: python
+    :start-after: [START howto_operator_http_sensor]
+    :end-before: [END howto_operator_http_sensor]
+
+.. _howto/operator:SimpleHttpOperator:
+
+Use the :class:`~airflow.providers.http.operators.http.SimpleHttpOperator` to call HTTP requests and get
+the response text back.
+
+In the first example we are calling a ``POST`` with json data and succeed when we get the same json data back
+otherwise the task will fail.
+
+.. exampleinclude:: ../../../airflow/providers/http/example_dags/example_http.py
+    :language: python
+    :start-after: [START howto_operator_http_t1]
+    :end-before: [END howto_operator_http_t1]
+
+Here we are calling a ``GET`` request and pass params to it. The task will succeed regardless of the response text.
+
+.. exampleinclude:: ../../../airflow/providers/http/example_dags/example_http.py
+    :language: python
+    :start-after: [START howto_operator_http_t2]
+    :end-before: [END howto_operator_http_t2]
+
+In the third example we are performing a ``PUT`` operation to put / set data according to the data that is being
+provided to the request.
+
+.. exampleinclude:: ../../../airflow/providers/http/example_dags/example_http.py
+    :language: python
+    :start-after: [START howto_operator_http_t3]
+    :end-before: [END howto_operator_http_t3]
+
+In this example we calling a ``DELETE`` operation to the ``delete`` endpoint. This time we are passing form data to the

Review comment:
       ```suggestion
   In this example we call a ``DELETE`` operation to the ``delete`` endpoint. This time we are passing form data to the
   ```

##########
File path: docs/howto/operator/http/http.rst
##########
@@ -0,0 +1,77 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+HTTP Operators
+==============
+
+In all of the following code examples we are using the ``http_default`` connection which means we calling requests
+against `httpbin <https://www.httpbin.org/>`__ site to perform basic http operations.

Review comment:
       ```suggestion
   The following code examples use the ``http_default`` connection which means the requests are sent against `httpbin <https://www.httpbin.org/>`__ site to perform basic HTTP operations.
   ```

##########
File path: docs/howto/operator/http/http.rst
##########
@@ -0,0 +1,77 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+HTTP Operators
+==============
+
+In all of the following code examples we are using the ``http_default`` connection which means we calling requests
+against `httpbin <https://www.httpbin.org/>`__ site to perform basic http operations.
+
+.. _howto/operator:HttpSensor:
+
+Use the :class:`~airflow.providers.http.sensors.http.HttpSensor` to poke until the ``response_check`` callable evaluates
+to ``true``.
+
+Here we are poking until httpbin gives us a response text containing ``httpbin``.
+
+.. exampleinclude:: ../../../airflow/providers/http/example_dags/example_http.py
+    :language: python
+    :start-after: [START howto_operator_http_sensor]
+    :end-before: [END howto_operator_http_sensor]
+
+.. _howto/operator:SimpleHttpOperator:
+
+Use the :class:`~airflow.providers.http.operators.http.SimpleHttpOperator` to call HTTP requests and get
+the response text back.
+
+In the first example we are calling a ``POST`` with json data and succeed when we get the same json data back
+otherwise the task will fail.
+
+.. exampleinclude:: ../../../airflow/providers/http/example_dags/example_http.py
+    :language: python
+    :start-after: [START howto_operator_http_t1]
+    :end-before: [END howto_operator_http_t1]
+
+Here we are calling a ``GET`` request and pass params to it. The task will succeed regardless of the response text.
+
+.. exampleinclude:: ../../../airflow/providers/http/example_dags/example_http.py
+    :language: python
+    :start-after: [START howto_operator_http_t2]
+    :end-before: [END howto_operator_http_t2]
+
+In the third example we are performing a ``PUT`` operation to put / set data according to the data that is being
+provided to the request.
+
+.. exampleinclude:: ../../../airflow/providers/http/example_dags/example_http.py
+    :language: python
+    :start-after: [START howto_operator_http_t3]
+    :end-before: [END howto_operator_http_t3]
+
+In this example we calling a ``DELETE`` operation to the ``delete`` endpoint. This time we are passing form data to the
+request.
+
+.. exampleinclude:: ../../../airflow/providers/http/example_dags/example_http.py
+    :language: python
+    :start-after: [START howto_operator_http_t4]
+    :end-before: [END howto_operator_http_t4]
+
+Here we are passing form data to a ``POST`` operation which is equal to a usual form submit.

Review comment:
       ```suggestion
   Here we pass form data to a ``POST`` operation which is equal to a usual form submit.
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org