apache-airflow-providers-telegram 4.3.1rc1__tar.gz → 4.4.0rc2__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_telegram-4.3.1rc1 → apache_airflow_providers_telegram-4.4.0rc2}/PKG-INFO +6 -6
- {apache_airflow_providers_telegram-4.3.1rc1 → apache_airflow_providers_telegram-4.4.0rc2}/README.rst +3 -3
- {apache_airflow_providers_telegram-4.3.1rc1 → apache_airflow_providers_telegram-4.4.0rc2}/airflow/providers/telegram/__init__.py +1 -1
- {apache_airflow_providers_telegram-4.3.1rc1 → apache_airflow_providers_telegram-4.4.0rc2}/airflow/providers/telegram/get_provider_info.py +8 -1
- {apache_airflow_providers_telegram-4.3.1rc1 → apache_airflow_providers_telegram-4.4.0rc2}/airflow/providers/telegram/hooks/telegram.py +22 -7
- {apache_airflow_providers_telegram-4.3.1rc1 → apache_airflow_providers_telegram-4.4.0rc2}/airflow/providers/telegram/operators/telegram.py +1 -1
- {apache_airflow_providers_telegram-4.3.1rc1 → apache_airflow_providers_telegram-4.4.0rc2}/pyproject.toml +3 -3
- {apache_airflow_providers_telegram-4.3.1rc1 → apache_airflow_providers_telegram-4.4.0rc2}/airflow/providers/telegram/LICENSE +0 -0
- {apache_airflow_providers_telegram-4.3.1rc1 → apache_airflow_providers_telegram-4.4.0rc2}/airflow/providers/telegram/hooks/__init__.py +0 -0
- {apache_airflow_providers_telegram-4.3.1rc1 → apache_airflow_providers_telegram-4.4.0rc2}/airflow/providers/telegram/operators/__init__.py +0 -0
{apache_airflow_providers_telegram-4.3.1rc1 → apache_airflow_providers_telegram-4.4.0rc2}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: apache-airflow-providers-telegram
|
3
|
-
Version: 4.
|
3
|
+
Version: 4.4.0rc2
|
4
4
|
Summary: Provider package apache-airflow-providers-telegram for Apache Airflow
|
5
5
|
Keywords: airflow-provider,telegram,airflow,integration
|
6
6
|
Author-email: Apache Software Foundation <dev@airflow.apache.org>
|
@@ -23,8 +23,8 @@ Classifier: Topic :: System :: Monitoring
|
|
23
23
|
Requires-Dist: apache-airflow>=2.6.0.dev0
|
24
24
|
Requires-Dist: python-telegram-bot>=20.2
|
25
25
|
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
26
|
-
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.
|
27
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.
|
26
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.4.0/changelog.html
|
27
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.4.0
|
28
28
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
29
29
|
Project-URL: Source Code, https://github.com/apache/airflow
|
30
30
|
Project-URL: Twitter, https://twitter.com/ApacheAirflow
|
@@ -74,7 +74,7 @@ Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
|
|
74
74
|
|
75
75
|
Package ``apache-airflow-providers-telegram``
|
76
76
|
|
77
|
-
Release: ``4.
|
77
|
+
Release: ``4.4.0.rc2``
|
78
78
|
|
79
79
|
|
80
80
|
`Telegram <https://telegram.org/>`__
|
@@ -87,7 +87,7 @@ This is a provider package for ``telegram`` provider. All classes for this provi
|
|
87
87
|
are in ``airflow.providers.telegram`` python package.
|
88
88
|
|
89
89
|
You can find package information and changelog for the provider
|
90
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.
|
90
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.4.0/>`_.
|
91
91
|
|
92
92
|
Installation
|
93
93
|
------------
|
@@ -109,4 +109,4 @@ PIP package Version required
|
|
109
109
|
======================= ==================
|
110
110
|
|
111
111
|
The changelog for the provider package can be found in the
|
112
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.
|
112
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.4.0/changelog.html>`_.
|
{apache_airflow_providers_telegram-4.3.1rc1 → apache_airflow_providers_telegram-4.4.0rc2}/README.rst
RENAMED
@@ -42,7 +42,7 @@
|
|
42
42
|
|
43
43
|
Package ``apache-airflow-providers-telegram``
|
44
44
|
|
45
|
-
Release: ``4.
|
45
|
+
Release: ``4.4.0.rc2``
|
46
46
|
|
47
47
|
|
48
48
|
`Telegram <https://telegram.org/>`__
|
@@ -55,7 +55,7 @@ This is a provider package for ``telegram`` provider. All classes for this provi
|
|
55
55
|
are in ``airflow.providers.telegram`` python package.
|
56
56
|
|
57
57
|
You can find package information and changelog for the provider
|
58
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.
|
58
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.4.0/>`_.
|
59
59
|
|
60
60
|
Installation
|
61
61
|
------------
|
@@ -77,4 +77,4 @@ PIP package Version required
|
|
77
77
|
======================= ==================
|
78
78
|
|
79
79
|
The changelog for the provider package can be found in the
|
80
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.
|
80
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.4.0/changelog.html>`_.
|
@@ -28,8 +28,9 @@ def get_provider_info():
|
|
28
28
|
"name": "Telegram",
|
29
29
|
"description": "`Telegram <https://telegram.org/>`__\n",
|
30
30
|
"state": "ready",
|
31
|
-
"source-date-epoch":
|
31
|
+
"source-date-epoch": 1709556330,
|
32
32
|
"versions": [
|
33
|
+
"4.4.0",
|
33
34
|
"4.3.1",
|
34
35
|
"4.3.0",
|
35
36
|
"4.2.0",
|
@@ -64,6 +65,12 @@ def get_provider_info():
|
|
64
65
|
"python-modules": ["airflow.providers.telegram.operators.telegram"],
|
65
66
|
}
|
66
67
|
],
|
68
|
+
"connection-types": [
|
69
|
+
{
|
70
|
+
"hook-class-name": "airflow.providers.telegram.hooks.telegram.TelegramHook",
|
71
|
+
"connection-type": "telegram",
|
72
|
+
}
|
73
|
+
],
|
67
74
|
"hooks": [
|
68
75
|
{"integration-name": "Telegram", "python-modules": ["airflow.providers.telegram.hooks.telegram"]}
|
69
76
|
],
|
@@ -19,6 +19,7 @@
|
|
19
19
|
from __future__ import annotations
|
20
20
|
|
21
21
|
import asyncio
|
22
|
+
from typing import Any
|
22
23
|
|
23
24
|
import telegram
|
24
25
|
import tenacity
|
@@ -38,14 +39,15 @@ class TelegramHook(BaseHook):
|
|
38
39
|
chat_id can also be provided in the connection using 'host' field in connection.
|
39
40
|
Following is the details of a telegram_connection:
|
40
41
|
name: 'telegram-connection-name'
|
41
|
-
conn_type: '
|
42
|
-
password: 'TELEGRAM_TOKEN'
|
42
|
+
conn_type: 'telegram'
|
43
|
+
password: 'TELEGRAM_TOKEN' (optional)
|
43
44
|
host: 'chat_id' (optional)
|
44
45
|
Examples:
|
45
46
|
.. code-block:: python
|
46
47
|
|
47
48
|
# Create hook
|
48
49
|
telegram_hook = TelegramHook(telegram_conn_id="telegram_default")
|
50
|
+
telegram_hook = TelegramHook() # will use telegram_default
|
49
51
|
# or telegram_hook = TelegramHook(telegram_conn_id='telegram_default', chat_id='-1xxx')
|
50
52
|
# or telegram_hook = TelegramHook(token='xxx:xxx', chat_id='-1xxx')
|
51
53
|
|
@@ -58,9 +60,14 @@ class TelegramHook(BaseHook):
|
|
58
60
|
:param chat_id: optional chat_id of the telegram chat/channel/group
|
59
61
|
"""
|
60
62
|
|
63
|
+
conn_name_attr = "telegram_conn_id"
|
64
|
+
default_conn_name = "telegram_default"
|
65
|
+
conn_type = "telegram"
|
66
|
+
hook_name = "Telegram"
|
67
|
+
|
61
68
|
def __init__(
|
62
69
|
self,
|
63
|
-
telegram_conn_id: str | None =
|
70
|
+
telegram_conn_id: str | None = default_conn_name,
|
64
71
|
token: str | None = None,
|
65
72
|
chat_id: str | None = None,
|
66
73
|
) -> None:
|
@@ -69,9 +76,17 @@ class TelegramHook(BaseHook):
|
|
69
76
|
self.chat_id = self.__get_chat_id(chat_id, telegram_conn_id)
|
70
77
|
self.connection = self.get_conn()
|
71
78
|
|
79
|
+
@classmethod
|
80
|
+
def get_ui_field_behaviour(cls) -> dict[str, Any]:
|
81
|
+
"""Return custom field behaviour."""
|
82
|
+
return {
|
83
|
+
"hidden_fields": ["schema", "extra", "login", "port", "extra"],
|
84
|
+
"relabeling": {},
|
85
|
+
}
|
86
|
+
|
72
87
|
def get_conn(self) -> telegram.Bot:
|
73
88
|
"""
|
74
|
-
|
89
|
+
Return the telegram bot client.
|
75
90
|
|
76
91
|
:return: telegram bot client
|
77
92
|
"""
|
@@ -79,7 +94,7 @@ class TelegramHook(BaseHook):
|
|
79
94
|
|
80
95
|
def __get_token(self, token: str | None, telegram_conn_id: str | None) -> str:
|
81
96
|
"""
|
82
|
-
|
97
|
+
Return the telegram API token.
|
83
98
|
|
84
99
|
:param token: telegram API token
|
85
100
|
:param telegram_conn_id: telegram connection name
|
@@ -100,7 +115,7 @@ class TelegramHook(BaseHook):
|
|
100
115
|
|
101
116
|
def __get_chat_id(self, chat_id: str | None, telegram_conn_id: str | None) -> str | None:
|
102
117
|
"""
|
103
|
-
|
118
|
+
Return the telegram chat ID for a chat/channel/group.
|
104
119
|
|
105
120
|
:param chat_id: optional chat ID
|
106
121
|
:param telegram_conn_id: telegram connection name
|
@@ -122,7 +137,7 @@ class TelegramHook(BaseHook):
|
|
122
137
|
)
|
123
138
|
def send_message(self, api_params: dict) -> None:
|
124
139
|
"""
|
125
|
-
|
140
|
+
Send the message to a telegram channel or chat.
|
126
141
|
|
127
142
|
:param api_params: params for telegram_instance.send_message. It can also be used to override chat_id
|
128
143
|
"""
|
@@ -72,7 +72,7 @@ class TelegramOperator(BaseOperator):
|
|
72
72
|
super().__init__(**kwargs)
|
73
73
|
|
74
74
|
def execute(self, context: Context) -> None:
|
75
|
-
"""
|
75
|
+
"""Call the TelegramHook to post the provided Telegram message."""
|
76
76
|
if self.text:
|
77
77
|
self.telegram_kwargs["text"] = self.text
|
78
78
|
|
@@ -28,7 +28,7 @@ build-backend = "flit_core.buildapi"
|
|
28
28
|
|
29
29
|
[project]
|
30
30
|
name = "apache-airflow-providers-telegram"
|
31
|
-
version = "4.
|
31
|
+
version = "4.4.0.rc2"
|
32
32
|
description = "Provider package apache-airflow-providers-telegram for Apache Airflow"
|
33
33
|
readme = "README.rst"
|
34
34
|
authors = [
|
@@ -60,8 +60,8 @@ dependencies = [
|
|
60
60
|
]
|
61
61
|
|
62
62
|
[project.urls]
|
63
|
-
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.
|
64
|
-
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.
|
63
|
+
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.4.0"
|
64
|
+
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.4.0/changelog.html"
|
65
65
|
"Bug Tracker" = "https://github.com/apache/airflow/issues"
|
66
66
|
"Source Code" = "https://github.com/apache/airflow"
|
67
67
|
"Slack Chat" = "https://s.apache.org/airflow-slack"
|
File without changes
|
File without changes
|