apache-airflow-providers-http 4.4.2rc1__tar.gz → 4.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- apache-airflow-providers-http-4.5.0/PKG-INFO +112 -0
- apache-airflow-providers-http-4.5.0/README.rst +78 -0
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/airflow/providers/http/__init__.py +1 -1
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/airflow/providers/http/get_provider_info.py +7 -0
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/airflow/providers/http/hooks/http.py +1 -1
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/airflow/providers/http/operators/http.py +50 -12
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/airflow/providers/http/sensors/http.py +1 -2
- apache-airflow-providers-http-4.5.0/airflow/providers/http/triggers/__init__.py +17 -0
- apache-airflow-providers-http-4.5.0/airflow/providers/http/triggers/http.py +124 -0
- apache-airflow-providers-http-4.5.0/apache_airflow_providers_http.egg-info/PKG-INFO +112 -0
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/apache_airflow_providers_http.egg-info/SOURCES.txt +2 -0
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/apache_airflow_providers_http.egg-info/requires.txt +1 -1
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/pyproject.toml +7 -5
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/setup.cfg +4 -3
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/setup.py +1 -1
- apache-airflow-providers-http-4.4.2rc1/PKG-INFO +0 -378
- apache-airflow-providers-http-4.4.2rc1/README.rst +0 -345
- apache-airflow-providers-http-4.4.2rc1/apache_airflow_providers_http.egg-info/PKG-INFO +0 -378
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/LICENSE +0 -0
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/MANIFEST.in +0 -0
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/NOTICE +0 -0
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/airflow/providers/http/hooks/__init__.py +0 -0
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/airflow/providers/http/operators/__init__.py +0 -0
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/airflow/providers/http/sensors/__init__.py +0 -0
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/apache_airflow_providers_http.egg-info/dependency_links.txt +0 -0
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/apache_airflow_providers_http.egg-info/entry_points.txt +0 -0
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/apache_airflow_providers_http.egg-info/not-zip-safe +0 -0
- {apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/apache_airflow_providers_http.egg-info/top_level.txt +0 -0
@@ -0,0 +1,112 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: apache-airflow-providers-http
|
3
|
+
Version: 4.5.0
|
4
|
+
Summary: Provider for Apache Airflow. Implements apache-airflow-providers-http package
|
5
|
+
Home-page: https://airflow.apache.org/
|
6
|
+
Download-URL: https://archive.apache.org/dist/airflow/providers
|
7
|
+
Author: Apache Software Foundation
|
8
|
+
Author-email: dev@airflow.apache.org
|
9
|
+
License: Apache License 2.0
|
10
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-http/4.5.0/
|
11
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-http/4.5.0/changelog.html
|
12
|
+
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
13
|
+
Project-URL: Source Code, https://github.com/apache/airflow
|
14
|
+
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
15
|
+
Project-URL: Twitter, https://twitter.com/ApacheAirflow
|
16
|
+
Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
|
17
|
+
Classifier: Development Status :: 5 - Production/Stable
|
18
|
+
Classifier: Environment :: Console
|
19
|
+
Classifier: Environment :: Web Environment
|
20
|
+
Classifier: Intended Audience :: Developers
|
21
|
+
Classifier: Intended Audience :: System Administrators
|
22
|
+
Classifier: Framework :: Apache Airflow
|
23
|
+
Classifier: Framework :: Apache Airflow :: Provider
|
24
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
25
|
+
Classifier: Programming Language :: Python :: 3.8
|
26
|
+
Classifier: Programming Language :: Python :: 3.9
|
27
|
+
Classifier: Programming Language :: Python :: 3.10
|
28
|
+
Classifier: Programming Language :: Python :: 3.11
|
29
|
+
Classifier: Topic :: System :: Monitoring
|
30
|
+
Requires-Python: ~=3.8
|
31
|
+
Description-Content-Type: text/x-rst
|
32
|
+
License-File: LICENSE
|
33
|
+
License-File: NOTICE
|
34
|
+
|
35
|
+
|
36
|
+
.. Licensed to the Apache Software Foundation (ASF) under one
|
37
|
+
or more contributor license agreements. See the NOTICE file
|
38
|
+
distributed with this work for additional information
|
39
|
+
regarding copyright ownership. The ASF licenses this file
|
40
|
+
to you under the Apache License, Version 2.0 (the
|
41
|
+
"License"); you may not use this file except in compliance
|
42
|
+
with the License. You may obtain a copy of the License at
|
43
|
+
|
44
|
+
.. http://www.apache.org/licenses/LICENSE-2.0
|
45
|
+
|
46
|
+
.. Unless required by applicable law or agreed to in writing,
|
47
|
+
software distributed under the License is distributed on an
|
48
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
49
|
+
KIND, either express or implied. See the License for the
|
50
|
+
specific language governing permissions and limitations
|
51
|
+
under the License.
|
52
|
+
|
53
|
+
.. Licensed to the Apache Software Foundation (ASF) under one
|
54
|
+
or more contributor license agreements. See the NOTICE file
|
55
|
+
distributed with this work for additional information
|
56
|
+
regarding copyright ownership. The ASF licenses this file
|
57
|
+
to you under the Apache License, Version 2.0 (the
|
58
|
+
"License"); you may not use this file except in compliance
|
59
|
+
with the License. You may obtain a copy of the License at
|
60
|
+
|
61
|
+
.. http://www.apache.org/licenses/LICENSE-2.0
|
62
|
+
|
63
|
+
.. Unless required by applicable law or agreed to in writing,
|
64
|
+
software distributed under the License is distributed on an
|
65
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
66
|
+
KIND, either express or implied. See the License for the
|
67
|
+
specific language governing permissions and limitations
|
68
|
+
under the License.
|
69
|
+
|
70
|
+
|
71
|
+
Package ``apache-airflow-providers-http``
|
72
|
+
|
73
|
+
Release: ``4.5.0``
|
74
|
+
|
75
|
+
|
76
|
+
`Hypertext Transfer Protocol (HTTP) <https://www.w3.org/Protocols/>`__
|
77
|
+
|
78
|
+
|
79
|
+
Provider package
|
80
|
+
----------------
|
81
|
+
|
82
|
+
This is a provider package for ``http`` provider. All classes for this provider package
|
83
|
+
are in ``airflow.providers.http`` python package.
|
84
|
+
|
85
|
+
You can find package information and changelog for the provider
|
86
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-http/4.5.0/>`_.
|
87
|
+
|
88
|
+
|
89
|
+
Installation
|
90
|
+
------------
|
91
|
+
|
92
|
+
You can install this package on top of an existing Airflow 2 installation (see ``Requirements`` below
|
93
|
+
for the minimum Airflow version supported) via
|
94
|
+
``pip install apache-airflow-providers-http``
|
95
|
+
|
96
|
+
The package supports the following python versions: 3.8,3.9,3.10,3.11
|
97
|
+
|
98
|
+
Requirements
|
99
|
+
------------
|
100
|
+
|
101
|
+
===================== ==================
|
102
|
+
PIP package Version required
|
103
|
+
===================== ==================
|
104
|
+
``apache-airflow`` ``>=2.4.0``
|
105
|
+
``requests`` ``>=2.26.0``
|
106
|
+
``requests_toolbelt``
|
107
|
+
``aiohttp``
|
108
|
+
``asgiref``
|
109
|
+
===================== ==================
|
110
|
+
|
111
|
+
The changelog for the provider package can be found in the
|
112
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-http/4.5.0/changelog.html>`_.
|
@@ -0,0 +1,78 @@
|
|
1
|
+
|
2
|
+
.. Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
4
|
+
distributed with this work for additional information
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
7
|
+
"License"); you may not use this file except in compliance
|
8
|
+
with the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
.. http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
.. Unless required by applicable law or agreed to in writing,
|
13
|
+
software distributed under the License is distributed on an
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
KIND, either express or implied. See the License for the
|
16
|
+
specific language governing permissions and limitations
|
17
|
+
under the License.
|
18
|
+
|
19
|
+
.. Licensed to the Apache Software Foundation (ASF) under one
|
20
|
+
or more contributor license agreements. See the NOTICE file
|
21
|
+
distributed with this work for additional information
|
22
|
+
regarding copyright ownership. The ASF licenses this file
|
23
|
+
to you under the Apache License, Version 2.0 (the
|
24
|
+
"License"); you may not use this file except in compliance
|
25
|
+
with the License. You may obtain a copy of the License at
|
26
|
+
|
27
|
+
.. http://www.apache.org/licenses/LICENSE-2.0
|
28
|
+
|
29
|
+
.. Unless required by applicable law or agreed to in writing,
|
30
|
+
software distributed under the License is distributed on an
|
31
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
32
|
+
KIND, either express or implied. See the License for the
|
33
|
+
specific language governing permissions and limitations
|
34
|
+
under the License.
|
35
|
+
|
36
|
+
|
37
|
+
Package ``apache-airflow-providers-http``
|
38
|
+
|
39
|
+
Release: ``4.5.0``
|
40
|
+
|
41
|
+
|
42
|
+
`Hypertext Transfer Protocol (HTTP) <https://www.w3.org/Protocols/>`__
|
43
|
+
|
44
|
+
|
45
|
+
Provider package
|
46
|
+
----------------
|
47
|
+
|
48
|
+
This is a provider package for ``http`` provider. All classes for this provider package
|
49
|
+
are in ``airflow.providers.http`` python package.
|
50
|
+
|
51
|
+
You can find package information and changelog for the provider
|
52
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-http/4.5.0/>`_.
|
53
|
+
|
54
|
+
|
55
|
+
Installation
|
56
|
+
------------
|
57
|
+
|
58
|
+
You can install this package on top of an existing Airflow 2 installation (see ``Requirements`` below
|
59
|
+
for the minimum Airflow version supported) via
|
60
|
+
``pip install apache-airflow-providers-http``
|
61
|
+
|
62
|
+
The package supports the following python versions: 3.8,3.9,3.10,3.11
|
63
|
+
|
64
|
+
Requirements
|
65
|
+
------------
|
66
|
+
|
67
|
+
===================== ==================
|
68
|
+
PIP package Version required
|
69
|
+
===================== ==================
|
70
|
+
``apache-airflow`` ``>=2.4.0``
|
71
|
+
``requests`` ``>=2.26.0``
|
72
|
+
``requests_toolbelt``
|
73
|
+
``aiohttp``
|
74
|
+
``asgiref``
|
75
|
+
===================== ==================
|
76
|
+
|
77
|
+
The changelog for the provider package can be found in the
|
78
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-http/4.5.0/changelog.html>`_.
|
@@ -29,6 +29,7 @@ def get_provider_info():
|
|
29
29
|
"description": "`Hypertext Transfer Protocol (HTTP) <https://www.w3.org/Protocols/>`__\n",
|
30
30
|
"suspended": False,
|
31
31
|
"versions": [
|
32
|
+
"4.5.0",
|
32
33
|
"4.4.2",
|
33
34
|
"4.4.1",
|
34
35
|
"4.4.0",
|
@@ -83,6 +84,12 @@ def get_provider_info():
|
|
83
84
|
"python-modules": ["airflow.providers.http.hooks.http"],
|
84
85
|
}
|
85
86
|
],
|
87
|
+
"triggers": [
|
88
|
+
{
|
89
|
+
"integration-name": "Hypertext Transfer Protocol (HTTP)",
|
90
|
+
"python-modules": ["airflow.providers.http.triggers.http"],
|
91
|
+
}
|
92
|
+
],
|
86
93
|
"connection-types": [
|
87
94
|
{"hook-class-name": "airflow.providers.http.hooks.http.HttpHook", "connection-type": "http"}
|
88
95
|
],
|
@@ -17,13 +17,18 @@
|
|
17
17
|
# under the License.
|
18
18
|
from __future__ import annotations
|
19
19
|
|
20
|
+
import base64
|
21
|
+
import pickle
|
20
22
|
from typing import TYPE_CHECKING, Any, Callable, Sequence
|
21
23
|
|
24
|
+
from requests import Response
|
22
25
|
from requests.auth import AuthBase
|
23
26
|
|
27
|
+
from airflow.configuration import conf
|
24
28
|
from airflow.exceptions import AirflowException
|
25
29
|
from airflow.models import BaseOperator
|
26
30
|
from airflow.providers.http.hooks.http import HttpHook
|
31
|
+
from airflow.providers.http.triggers.http import HttpTrigger
|
27
32
|
|
28
33
|
if TYPE_CHECKING:
|
29
34
|
from airflow.utils.context import Context
|
@@ -61,6 +66,7 @@ class SimpleHttpOperator(BaseOperator):
|
|
61
66
|
:param tcp_keep_alive_count: The TCP Keep Alive count parameter (corresponds to ``socket.TCP_KEEPCNT``)
|
62
67
|
:param tcp_keep_alive_interval: The TCP Keep Alive interval parameter (corresponds to
|
63
68
|
``socket.TCP_KEEPINTVL``)
|
69
|
+
:param deferrable: Run operator in the deferrable mode
|
64
70
|
"""
|
65
71
|
|
66
72
|
template_fields: Sequence[str] = (
|
@@ -89,6 +95,7 @@ class SimpleHttpOperator(BaseOperator):
|
|
89
95
|
tcp_keep_alive_idle: int = 120,
|
90
96
|
tcp_keep_alive_count: int = 20,
|
91
97
|
tcp_keep_alive_interval: int = 30,
|
98
|
+
deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
|
92
99
|
**kwargs: Any,
|
93
100
|
) -> None:
|
94
101
|
super().__init__(**kwargs)
|
@@ -106,23 +113,42 @@ class SimpleHttpOperator(BaseOperator):
|
|
106
113
|
self.tcp_keep_alive_idle = tcp_keep_alive_idle
|
107
114
|
self.tcp_keep_alive_count = tcp_keep_alive_count
|
108
115
|
self.tcp_keep_alive_interval = tcp_keep_alive_interval
|
116
|
+
self.deferrable = deferrable
|
109
117
|
|
110
118
|
def execute(self, context: Context) -> Any:
|
111
|
-
|
119
|
+
if self.deferrable:
|
120
|
+
self.defer(
|
121
|
+
trigger=HttpTrigger(
|
122
|
+
http_conn_id=self.http_conn_id,
|
123
|
+
auth_type=self.auth_type,
|
124
|
+
method=self.method,
|
125
|
+
endpoint=self.endpoint,
|
126
|
+
headers=self.headers,
|
127
|
+
data=self.data,
|
128
|
+
extra_options=self.extra_options,
|
129
|
+
),
|
130
|
+
method_name="execute_complete",
|
131
|
+
)
|
132
|
+
else:
|
133
|
+
http = HttpHook(
|
134
|
+
self.method,
|
135
|
+
http_conn_id=self.http_conn_id,
|
136
|
+
auth_type=self.auth_type,
|
137
|
+
tcp_keep_alive=self.tcp_keep_alive,
|
138
|
+
tcp_keep_alive_idle=self.tcp_keep_alive_idle,
|
139
|
+
tcp_keep_alive_count=self.tcp_keep_alive_count,
|
140
|
+
tcp_keep_alive_interval=self.tcp_keep_alive_interval,
|
141
|
+
)
|
142
|
+
|
143
|
+
self.log.info("Calling HTTP method")
|
112
144
|
|
113
|
-
|
114
|
-
self.
|
115
|
-
http_conn_id=self.http_conn_id,
|
116
|
-
auth_type=self.auth_type,
|
117
|
-
tcp_keep_alive=self.tcp_keep_alive,
|
118
|
-
tcp_keep_alive_idle=self.tcp_keep_alive_idle,
|
119
|
-
tcp_keep_alive_count=self.tcp_keep_alive_count,
|
120
|
-
tcp_keep_alive_interval=self.tcp_keep_alive_interval,
|
121
|
-
)
|
145
|
+
response = http.run(self.endpoint, self.data, self.headers, self.extra_options)
|
146
|
+
return self.process_response(context=context, response=response)
|
122
147
|
|
123
|
-
|
148
|
+
def process_response(self, context: Context, response: Response) -> str:
|
149
|
+
"""Process the response."""
|
150
|
+
from airflow.utils.operator_helpers import determine_kwargs
|
124
151
|
|
125
|
-
response = http.run(self.endpoint, self.data, self.headers, self.extra_options)
|
126
152
|
if self.log_response:
|
127
153
|
self.log.info(response.text)
|
128
154
|
if self.response_check:
|
@@ -133,3 +159,15 @@ class SimpleHttpOperator(BaseOperator):
|
|
133
159
|
kwargs = determine_kwargs(self.response_filter, [response], context)
|
134
160
|
return self.response_filter(response, **kwargs)
|
135
161
|
return response.text
|
162
|
+
|
163
|
+
def execute_complete(self, context: Context, event: dict):
|
164
|
+
"""
|
165
|
+
Callback for when the trigger fires - returns immediately.
|
166
|
+
|
167
|
+
Relies on trigger to throw an exception, otherwise it assumes execution was successful.
|
168
|
+
"""
|
169
|
+
if event["status"] == "success":
|
170
|
+
response = pickle.loads(base64.standard_b64decode(event["response"]))
|
171
|
+
return self.process_response(context=context, response=response)
|
172
|
+
else:
|
173
|
+
raise AirflowException(f"Unexpected error in the operation: {event['message']}")
|
@@ -29,8 +29,7 @@ if TYPE_CHECKING:
|
|
29
29
|
|
30
30
|
class HttpSensor(BaseSensorOperator):
|
31
31
|
"""
|
32
|
-
|
33
|
-
404 Not Found or `response_check` returning False.
|
32
|
+
Execute HTTP GET statement; return False on failure 404 Not Found or `response_check` returning False.
|
34
33
|
|
35
34
|
HTTP Error codes other than 404 (like 403) or Connection Refused Error
|
36
35
|
would raise an exception and fail the sensor itself directly (no more poking).
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
4
|
+
# distributed with this work for additional information
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
7
|
+
# "License"); you may not use this file except in compliance
|
8
|
+
# with the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
13
|
+
# software distributed under the License is distributed on an
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
# KIND, either express or implied. See the License for the
|
16
|
+
# specific language governing permissions and limitations
|
17
|
+
# under the License.
|
@@ -0,0 +1,124 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
from __future__ import annotations
|
18
|
+
|
19
|
+
import base64
|
20
|
+
import pickle
|
21
|
+
from typing import Any, AsyncIterator
|
22
|
+
|
23
|
+
import requests
|
24
|
+
from aiohttp.client_reqrep import ClientResponse
|
25
|
+
from requests.cookies import RequestsCookieJar
|
26
|
+
from requests.structures import CaseInsensitiveDict
|
27
|
+
|
28
|
+
from airflow.providers.http.hooks.http import HttpAsyncHook
|
29
|
+
from airflow.triggers.base import BaseTrigger, TriggerEvent
|
30
|
+
|
31
|
+
|
32
|
+
class HttpTrigger(BaseTrigger):
|
33
|
+
"""
|
34
|
+
HttpTrigger run on the trigger worker.
|
35
|
+
|
36
|
+
:param http_conn_id: http connection id that has the base
|
37
|
+
API url i.e https://www.google.com/ and optional authentication credentials. Default
|
38
|
+
headers can also be specified in the Extra field in json format.
|
39
|
+
:param auth_type: The auth type for the service
|
40
|
+
:param method: the API method to be called
|
41
|
+
:param endpoint: Endpoint to be called, i.e. ``resource/v1/query?``.
|
42
|
+
:param headers: Additional headers to be passed through as a dict.
|
43
|
+
:param data: Payload to be uploaded or request parameters.
|
44
|
+
:param extra_options: Additional kwargs to pass when creating a request.
|
45
|
+
For example, ``run(json=obj)`` is passed as
|
46
|
+
``aiohttp.ClientSession().get(json=obj)``.
|
47
|
+
2XX or 3XX status codes
|
48
|
+
"""
|
49
|
+
|
50
|
+
def __init__(
|
51
|
+
self,
|
52
|
+
http_conn_id: str = "http_default",
|
53
|
+
auth_type: Any = None,
|
54
|
+
method: str = "POST",
|
55
|
+
endpoint: str | None = None,
|
56
|
+
headers: dict[str, str] | None = None,
|
57
|
+
data: Any = None,
|
58
|
+
extra_options: dict[str, Any] | None = None,
|
59
|
+
):
|
60
|
+
super().__init__()
|
61
|
+
self.http_conn_id = http_conn_id
|
62
|
+
self.method = method
|
63
|
+
self.auth_type = auth_type
|
64
|
+
self.endpoint = endpoint
|
65
|
+
self.headers = headers
|
66
|
+
self.data = data
|
67
|
+
self.extra_options = extra_options
|
68
|
+
|
69
|
+
def serialize(self) -> tuple[str, dict[str, Any]]:
|
70
|
+
"""Serializes HttpTrigger arguments and classpath."""
|
71
|
+
return (
|
72
|
+
"airflow.providers.http.triggers.http.HttpTrigger",
|
73
|
+
{
|
74
|
+
"http_conn_id": self.http_conn_id,
|
75
|
+
"method": self.method,
|
76
|
+
"auth_type": self.auth_type,
|
77
|
+
"endpoint": self.endpoint,
|
78
|
+
"headers": self.headers,
|
79
|
+
"data": self.data,
|
80
|
+
"extra_options": self.extra_options,
|
81
|
+
},
|
82
|
+
)
|
83
|
+
|
84
|
+
async def run(self) -> AsyncIterator[TriggerEvent]:
|
85
|
+
"""Makes a series of asynchronous http calls via an http hook."""
|
86
|
+
hook = HttpAsyncHook(
|
87
|
+
method=self.method,
|
88
|
+
http_conn_id=self.http_conn_id,
|
89
|
+
auth_type=self.auth_type,
|
90
|
+
)
|
91
|
+
try:
|
92
|
+
client_response = await hook.run(
|
93
|
+
endpoint=self.endpoint,
|
94
|
+
data=self.data,
|
95
|
+
headers=self.headers,
|
96
|
+
extra_options=self.extra_options,
|
97
|
+
)
|
98
|
+
response = await self._convert_response(client_response)
|
99
|
+
yield TriggerEvent(
|
100
|
+
{
|
101
|
+
"status": "success",
|
102
|
+
"response": base64.standard_b64encode(pickle.dumps(response)).decode("ascii"),
|
103
|
+
}
|
104
|
+
)
|
105
|
+
except Exception as e:
|
106
|
+
yield TriggerEvent({"status": "error", "message": str(e)})
|
107
|
+
# yield TriggerEvent({"status": "error", "message": str(traceback.format_exc())})
|
108
|
+
|
109
|
+
@staticmethod
|
110
|
+
async def _convert_response(client_response: ClientResponse) -> requests.Response:
|
111
|
+
"""Convert aiohttp.client_reqrep.ClientResponse to requests.Response."""
|
112
|
+
response = requests.Response()
|
113
|
+
response._content = await client_response.read()
|
114
|
+
response.status_code = client_response.status
|
115
|
+
response.headers = CaseInsensitiveDict(client_response.headers)
|
116
|
+
response.url = str(client_response.url)
|
117
|
+
response.history = [await HttpTrigger._convert_response(h) for h in client_response.history]
|
118
|
+
response.encoding = client_response.get_encoding()
|
119
|
+
response.reason = str(client_response.reason)
|
120
|
+
cookies = RequestsCookieJar()
|
121
|
+
for (k, v) in client_response.cookies.items():
|
122
|
+
cookies.set(k, v)
|
123
|
+
response.cookies = cookies
|
124
|
+
return response
|
@@ -0,0 +1,112 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: apache-airflow-providers-http
|
3
|
+
Version: 4.5.0
|
4
|
+
Summary: Provider for Apache Airflow. Implements apache-airflow-providers-http package
|
5
|
+
Home-page: https://airflow.apache.org/
|
6
|
+
Download-URL: https://archive.apache.org/dist/airflow/providers
|
7
|
+
Author: Apache Software Foundation
|
8
|
+
Author-email: dev@airflow.apache.org
|
9
|
+
License: Apache License 2.0
|
10
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-http/4.5.0/
|
11
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-http/4.5.0/changelog.html
|
12
|
+
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
13
|
+
Project-URL: Source Code, https://github.com/apache/airflow
|
14
|
+
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
15
|
+
Project-URL: Twitter, https://twitter.com/ApacheAirflow
|
16
|
+
Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
|
17
|
+
Classifier: Development Status :: 5 - Production/Stable
|
18
|
+
Classifier: Environment :: Console
|
19
|
+
Classifier: Environment :: Web Environment
|
20
|
+
Classifier: Intended Audience :: Developers
|
21
|
+
Classifier: Intended Audience :: System Administrators
|
22
|
+
Classifier: Framework :: Apache Airflow
|
23
|
+
Classifier: Framework :: Apache Airflow :: Provider
|
24
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
25
|
+
Classifier: Programming Language :: Python :: 3.8
|
26
|
+
Classifier: Programming Language :: Python :: 3.9
|
27
|
+
Classifier: Programming Language :: Python :: 3.10
|
28
|
+
Classifier: Programming Language :: Python :: 3.11
|
29
|
+
Classifier: Topic :: System :: Monitoring
|
30
|
+
Requires-Python: ~=3.8
|
31
|
+
Description-Content-Type: text/x-rst
|
32
|
+
License-File: LICENSE
|
33
|
+
License-File: NOTICE
|
34
|
+
|
35
|
+
|
36
|
+
.. Licensed to the Apache Software Foundation (ASF) under one
|
37
|
+
or more contributor license agreements. See the NOTICE file
|
38
|
+
distributed with this work for additional information
|
39
|
+
regarding copyright ownership. The ASF licenses this file
|
40
|
+
to you under the Apache License, Version 2.0 (the
|
41
|
+
"License"); you may not use this file except in compliance
|
42
|
+
with the License. You may obtain a copy of the License at
|
43
|
+
|
44
|
+
.. http://www.apache.org/licenses/LICENSE-2.0
|
45
|
+
|
46
|
+
.. Unless required by applicable law or agreed to in writing,
|
47
|
+
software distributed under the License is distributed on an
|
48
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
49
|
+
KIND, either express or implied. See the License for the
|
50
|
+
specific language governing permissions and limitations
|
51
|
+
under the License.
|
52
|
+
|
53
|
+
.. Licensed to the Apache Software Foundation (ASF) under one
|
54
|
+
or more contributor license agreements. See the NOTICE file
|
55
|
+
distributed with this work for additional information
|
56
|
+
regarding copyright ownership. The ASF licenses this file
|
57
|
+
to you under the Apache License, Version 2.0 (the
|
58
|
+
"License"); you may not use this file except in compliance
|
59
|
+
with the License. You may obtain a copy of the License at
|
60
|
+
|
61
|
+
.. http://www.apache.org/licenses/LICENSE-2.0
|
62
|
+
|
63
|
+
.. Unless required by applicable law or agreed to in writing,
|
64
|
+
software distributed under the License is distributed on an
|
65
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
66
|
+
KIND, either express or implied. See the License for the
|
67
|
+
specific language governing permissions and limitations
|
68
|
+
under the License.
|
69
|
+
|
70
|
+
|
71
|
+
Package ``apache-airflow-providers-http``
|
72
|
+
|
73
|
+
Release: ``4.5.0``
|
74
|
+
|
75
|
+
|
76
|
+
`Hypertext Transfer Protocol (HTTP) <https://www.w3.org/Protocols/>`__
|
77
|
+
|
78
|
+
|
79
|
+
Provider package
|
80
|
+
----------------
|
81
|
+
|
82
|
+
This is a provider package for ``http`` provider. All classes for this provider package
|
83
|
+
are in ``airflow.providers.http`` python package.
|
84
|
+
|
85
|
+
You can find package information and changelog for the provider
|
86
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-http/4.5.0/>`_.
|
87
|
+
|
88
|
+
|
89
|
+
Installation
|
90
|
+
------------
|
91
|
+
|
92
|
+
You can install this package on top of an existing Airflow 2 installation (see ``Requirements`` below
|
93
|
+
for the minimum Airflow version supported) via
|
94
|
+
``pip install apache-airflow-providers-http``
|
95
|
+
|
96
|
+
The package supports the following python versions: 3.8,3.9,3.10,3.11
|
97
|
+
|
98
|
+
Requirements
|
99
|
+
------------
|
100
|
+
|
101
|
+
===================== ==================
|
102
|
+
PIP package Version required
|
103
|
+
===================== ==================
|
104
|
+
``apache-airflow`` ``>=2.4.0``
|
105
|
+
``requests`` ``>=2.26.0``
|
106
|
+
``requests_toolbelt``
|
107
|
+
``aiohttp``
|
108
|
+
``asgiref``
|
109
|
+
===================== ==================
|
110
|
+
|
111
|
+
The changelog for the provider package can be found in the
|
112
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-http/4.5.0/changelog.html>`_.
|
@@ -13,6 +13,8 @@ airflow/providers/http/operators/__init__.py
|
|
13
13
|
airflow/providers/http/operators/http.py
|
14
14
|
airflow/providers/http/sensors/__init__.py
|
15
15
|
airflow/providers/http/sensors/http.py
|
16
|
+
airflow/providers/http/triggers/__init__.py
|
17
|
+
airflow/providers/http/triggers/http.py
|
16
18
|
apache_airflow_providers_http.egg-info/PKG-INFO
|
17
19
|
apache_airflow_providers_http.egg-info/SOURCES.txt
|
18
20
|
apache_airflow_providers_http.egg-info/dependency_links.txt
|
{apache-airflow-providers-http-4.4.2rc1 → apache-airflow-providers-http-4.5.0}/pyproject.toml
RENAMED
@@ -17,11 +17,13 @@
|
|
17
17
|
[tool.black]
|
18
18
|
line-length = 110
|
19
19
|
target-version = ['py37', 'py38', 'py39', 'py310']
|
20
|
-
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
20
|
+
|
21
|
+
# Editable installs are currently broken using setuptools 64.0.0 and above. The problem is tracked in
|
22
|
+
# https://github.com/pypa/setuptools/issues/3548. We're also discussing how we could potentially fix
|
23
|
+
# this problem on our end in issue https://github.com/apache/airflow/issues/30764. Until then we need
|
24
|
+
# to use one of the following workarounds locally for editable installs:
|
25
|
+
# 1) Pin setuptools <= 63.4.3 below in the [build-system] section.
|
26
|
+
# 2) Include your airflow source code directory in PYTHONPATH.
|
25
27
|
[build-system]
|
26
28
|
requires = ['setuptools==67.2.0']
|
27
29
|
build-backend = "setuptools.build_meta"
|
@@ -27,7 +27,8 @@ classifiers =
|
|
27
27
|
Programming Language :: Python :: 3.11
|
28
28
|
Topic :: System :: Monitoring
|
29
29
|
project_urls =
|
30
|
-
Documentation=https://airflow.apache.org/docs/apache-airflow-providers-http/4.
|
30
|
+
Documentation=https://airflow.apache.org/docs/apache-airflow-providers-http/4.5.0/
|
31
|
+
Changelog=https://airflow.apache.org/docs/apache-airflow-providers-http/4.5.0/changelog.html
|
31
32
|
Bug Tracker=https://github.com/apache/airflow/issues
|
32
33
|
Source Code=https://github.com/apache/airflow
|
33
34
|
Slack Chat=https://s.apache.org/airflow-slack
|
@@ -47,7 +48,7 @@ setup_requires =
|
|
47
48
|
wheel
|
48
49
|
install_requires =
|
49
50
|
aiohttp
|
50
|
-
apache-airflow>=2.4.0
|
51
|
+
apache-airflow>=2.4.0
|
51
52
|
asgiref
|
52
53
|
requests>=2.26.0
|
53
54
|
requests_toolbelt
|
@@ -60,6 +61,6 @@ apache_airflow_provider =
|
|
60
61
|
packages = airflow.providers.http
|
61
62
|
|
62
63
|
[egg_info]
|
63
|
-
tag_build =
|
64
|
+
tag_build =
|
64
65
|
tag_date = 0
|
65
66
|
|