apache-airflow-providers-telegram 4.4.0rc1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-telegram
3
- Version: 4.4.0rc1
3
+ Version: 4.5.0
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>
@@ -19,12 +19,13 @@ Classifier: Programming Language :: Python :: 3.8
19
19
  Classifier: Programming Language :: Python :: 3.9
20
20
  Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
22
23
  Classifier: Topic :: System :: Monitoring
23
- Requires-Dist: apache-airflow>=2.6.0.dev0
24
+ Requires-Dist: apache-airflow>=2.7.0
24
25
  Requires-Dist: python-telegram-bot>=20.2
25
26
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
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
27
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.5.0/changelog.html
28
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.5.0
28
29
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
29
30
  Project-URL: Source Code, https://github.com/apache/airflow
30
31
  Project-URL: Twitter, https://twitter.com/ApacheAirflow
@@ -74,7 +75,7 @@ Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
74
75
 
75
76
  Package ``apache-airflow-providers-telegram``
76
77
 
77
- Release: ``4.4.0.rc1``
78
+ Release: ``4.5.0``
78
79
 
79
80
 
80
81
  `Telegram <https://telegram.org/>`__
@@ -87,7 +88,7 @@ This is a provider package for ``telegram`` provider. All classes for this provi
87
88
  are in ``airflow.providers.telegram`` python package.
88
89
 
89
90
  You can find package information and changelog for the provider
90
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.4.0/>`_.
91
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.5.0/>`_.
91
92
 
92
93
  Installation
93
94
  ------------
@@ -96,7 +97,7 @@ You can install this package on top of an existing Airflow 2 installation (see `
96
97
  for the minimum Airflow version supported) via
97
98
  ``pip install apache-airflow-providers-telegram``
98
99
 
99
- The package supports the following python versions: 3.8,3.9,3.10,3.11
100
+ The package supports the following python versions: 3.8,3.9,3.10,3.11,3.12
100
101
 
101
102
  Requirements
102
103
  ------------
@@ -104,9 +105,9 @@ Requirements
104
105
  ======================= ==================
105
106
  PIP package Version required
106
107
  ======================= ==================
107
- ``apache-airflow`` ``>=2.6.0``
108
+ ``apache-airflow`` ``>=2.7.0``
108
109
  ``python-telegram-bot`` ``>=20.2``
109
110
  ======================= ==================
110
111
 
111
112
  The changelog for the provider package can be found in the
112
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.4.0/changelog.html>`_.
113
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.5.0/changelog.html>`_.
@@ -42,7 +42,7 @@
42
42
 
43
43
  Package ``apache-airflow-providers-telegram``
44
44
 
45
- Release: ``4.4.0.rc1``
45
+ Release: ``4.5.0``
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.4.0/>`_.
58
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.5.0/>`_.
59
59
 
60
60
  Installation
61
61
  ------------
@@ -64,7 +64,7 @@ You can install this package on top of an existing Airflow 2 installation (see `
64
64
  for the minimum Airflow version supported) via
65
65
  ``pip install apache-airflow-providers-telegram``
66
66
 
67
- The package supports the following python versions: 3.8,3.9,3.10,3.11
67
+ The package supports the following python versions: 3.8,3.9,3.10,3.11,3.12
68
68
 
69
69
  Requirements
70
70
  ------------
@@ -72,9 +72,9 @@ Requirements
72
72
  ======================= ==================
73
73
  PIP package Version required
74
74
  ======================= ==================
75
- ``apache-airflow`` ``>=2.6.0``
75
+ ``apache-airflow`` ``>=2.7.0``
76
76
  ``python-telegram-bot`` ``>=20.2``
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.4.0/changelog.html>`_.
80
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.5.0/changelog.html>`_.
@@ -27,7 +27,7 @@ import packaging.version
27
27
 
28
28
  __all__ = ["__version__"]
29
29
 
30
- __version__ = "4.4.0"
30
+ __version__ = "4.5.0"
31
31
 
32
32
  try:
33
33
  from airflow import __version__ as airflow_version
@@ -35,8 +35,8 @@ except ImportError:
35
35
  from airflow.version import version as airflow_version
36
36
 
37
37
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
38
- "2.6.0"
38
+ "2.7.0"
39
39
  ):
40
40
  raise RuntimeError(
41
- f"The package `apache-airflow-providers-telegram:{__version__}` needs Apache Airflow 2.6.0+"
41
+ f"The package `apache-airflow-providers-telegram:{__version__}` needs Apache Airflow 2.7.0+"
42
42
  )
@@ -28,9 +28,11 @@ def get_provider_info():
28
28
  "name": "Telegram",
29
29
  "description": "`Telegram <https://telegram.org/>`__\n",
30
30
  "state": "ready",
31
- "source-date-epoch": 1705912297,
31
+ "source-date-epoch": 1714477687,
32
32
  "versions": [
33
+ "4.5.0",
33
34
  "4.4.0",
35
+ "4.3.1",
34
36
  "4.3.0",
35
37
  "4.2.0",
36
38
  "4.1.1",
@@ -48,7 +50,7 @@ def get_provider_info():
48
50
  "1.0.1",
49
51
  "1.0.0",
50
52
  ],
51
- "dependencies": ["apache-airflow>=2.6.0", "python-telegram-bot>=20.2"],
53
+ "dependencies": ["apache-airflow>=2.7.0", "python-telegram-bot>=20.2"],
52
54
  "integrations": [
53
55
  {
54
56
  "integration-name": "Telegram",
@@ -64,6 +66,12 @@ def get_provider_info():
64
66
  "python-modules": ["airflow.providers.telegram.operators.telegram"],
65
67
  }
66
68
  ],
69
+ "connection-types": [
70
+ {
71
+ "hook-class-name": "airflow.providers.telegram.hooks.telegram.TelegramHook",
72
+ "connection-type": "telegram",
73
+ }
74
+ ],
67
75
  "hooks": [
68
76
  {"integration-name": "Telegram", "python-modules": ["airflow.providers.telegram.hooks.telegram"]}
69
77
  ],
@@ -16,9 +16,11 @@
16
16
  # specific language governing permissions and limitations
17
17
  # under the License.
18
18
  """Hook for Telegram."""
19
+
19
20
  from __future__ import annotations
20
21
 
21
22
  import asyncio
23
+ from typing import Any
22
24
 
23
25
  import telegram
24
26
  import tenacity
@@ -38,14 +40,15 @@ class TelegramHook(BaseHook):
38
40
  chat_id can also be provided in the connection using 'host' field in connection.
39
41
  Following is the details of a telegram_connection:
40
42
  name: 'telegram-connection-name'
41
- conn_type: 'http'
42
- password: 'TELEGRAM_TOKEN'
43
+ conn_type: 'telegram'
44
+ password: 'TELEGRAM_TOKEN' (optional)
43
45
  host: 'chat_id' (optional)
44
46
  Examples:
45
47
  .. code-block:: python
46
48
 
47
49
  # Create hook
48
50
  telegram_hook = TelegramHook(telegram_conn_id="telegram_default")
51
+ telegram_hook = TelegramHook() # will use telegram_default
49
52
  # or telegram_hook = TelegramHook(telegram_conn_id='telegram_default', chat_id='-1xxx')
50
53
  # or telegram_hook = TelegramHook(token='xxx:xxx', chat_id='-1xxx')
51
54
 
@@ -58,21 +61,33 @@ class TelegramHook(BaseHook):
58
61
  :param chat_id: optional chat_id of the telegram chat/channel/group
59
62
  """
60
63
 
64
+ conn_name_attr = "telegram_conn_id"
65
+ default_conn_name = "telegram_default"
66
+ conn_type = "telegram"
67
+ hook_name = "Telegram"
68
+
61
69
  def __init__(
62
70
  self,
63
- telegram_conn_id: str | None = None,
71
+ telegram_conn_id: str | None = default_conn_name,
64
72
  token: str | None = None,
65
73
  chat_id: str | None = None,
66
- **kwargs,
67
74
  ) -> None:
68
- super().__init__(**kwargs)
75
+ super().__init__()
69
76
  self.token = self.__get_token(token, telegram_conn_id)
70
77
  self.chat_id = self.__get_chat_id(chat_id, telegram_conn_id)
71
78
  self.connection = self.get_conn()
72
79
 
80
+ @classmethod
81
+ def get_ui_field_behaviour(cls) -> dict[str, Any]:
82
+ """Return custom field behaviour."""
83
+ return {
84
+ "hidden_fields": ["schema", "extra", "login", "port", "extra"],
85
+ "relabeling": {},
86
+ }
87
+
73
88
  def get_conn(self) -> telegram.Bot:
74
89
  """
75
- Returns the telegram bot client.
90
+ Return the telegram bot client.
76
91
 
77
92
  :return: telegram bot client
78
93
  """
@@ -80,7 +95,7 @@ class TelegramHook(BaseHook):
80
95
 
81
96
  def __get_token(self, token: str | None, telegram_conn_id: str | None) -> str:
82
97
  """
83
- Returns the telegram API token.
98
+ Return the telegram API token.
84
99
 
85
100
  :param token: telegram API token
86
101
  :param telegram_conn_id: telegram connection name
@@ -101,7 +116,7 @@ class TelegramHook(BaseHook):
101
116
 
102
117
  def __get_chat_id(self, chat_id: str | None, telegram_conn_id: str | None) -> str | None:
103
118
  """
104
- Returns the telegram chat ID for a chat/channel/group.
119
+ Return the telegram chat ID for a chat/channel/group.
105
120
 
106
121
  :param chat_id: optional chat ID
107
122
  :param telegram_conn_id: telegram connection name
@@ -123,7 +138,7 @@ class TelegramHook(BaseHook):
123
138
  )
124
139
  def send_message(self, api_params: dict) -> None:
125
140
  """
126
- Sends the message to a telegram channel or chat.
141
+ Send the message to a telegram channel or chat.
127
142
 
128
143
  :param api_params: params for telegram_instance.send_message. It can also be used to override chat_id
129
144
  """
@@ -16,6 +16,7 @@
16
16
  # specific language governing permissions and limitations
17
17
  # under the License.
18
18
  """Operator for Telegram."""
19
+
19
20
  from __future__ import annotations
20
21
 
21
22
  from typing import TYPE_CHECKING, Sequence
@@ -72,7 +73,7 @@ class TelegramOperator(BaseOperator):
72
73
  super().__init__(**kwargs)
73
74
 
74
75
  def execute(self, context: Context) -> None:
75
- """Calls the TelegramHook to post the provided Telegram message."""
76
+ """Call the TelegramHook to post the provided Telegram message."""
76
77
  if self.text:
77
78
  self.telegram_kwargs["text"] = self.text
78
79
 
@@ -28,7 +28,7 @@ build-backend = "flit_core.buildapi"
28
28
 
29
29
  [project]
30
30
  name = "apache-airflow-providers-telegram"
31
- version = "4.4.0.rc1"
31
+ version = "4.5.0"
32
32
  description = "Provider package apache-airflow-providers-telegram for Apache Airflow"
33
33
  readme = "README.rst"
34
34
  authors = [
@@ -51,17 +51,18 @@ classifiers = [
51
51
  "Programming Language :: Python :: 3.9",
52
52
  "Programming Language :: Python :: 3.10",
53
53
  "Programming Language :: Python :: 3.11",
54
+ "Programming Language :: Python :: 3.12",
54
55
  "Topic :: System :: Monitoring",
55
56
  ]
56
57
  requires-python = "~=3.8"
57
58
  dependencies = [
58
- "apache-airflow>=2.6.0.dev0",
59
+ "apache-airflow>=2.7.0",
59
60
  "python-telegram-bot>=20.2",
60
61
  ]
61
62
 
62
63
  [project.urls]
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"
64
+ "Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.5.0"
65
+ "Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-telegram/4.5.0/changelog.html"
65
66
  "Bug Tracker" = "https://github.com/apache/airflow/issues"
66
67
  "Source Code" = "https://github.com/apache/airflow"
67
68
  "Slack Chat" = "https://s.apache.org/airflow-slack"