Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions airflow/providers/telegram/example_dags/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion docs/apache-airflow-providers-telegram/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Content
:maxdepth: 1
:caption: Resources

Example DAGs <https://github.com/apache/airflow/tree/main/airflow/providers/telegram/example_dags>
Example DAGs <https://github.com/apache/airflow/tree/main/tests/system/providers/telegram>
PyPI Repository <https://pypi.org/project/apache-airflow-providers-telegram/>
Installing from sources <installing-providers-from-sources>

Expand Down
2 changes: 1 addition & 1 deletion docs/apache-airflow-providers-telegram/operators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ the connection metadata is structured as follows:

An example usage of the TelegramOperator is as follows:

.. exampleinclude:: /../../airflow/providers/telegram/example_dags/example_telegram.py
.. exampleinclude:: /../../tests/system/providers/telegram/example_telegram.py
:language: python
:start-after: [START howto_operator_telegram]
:end-before: [END howto_operator_telegram]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,32 @@
Example use of Telegram operator.
"""

import os
from datetime import datetime

from airflow import DAG
from airflow.providers.telegram.operators.telegram import TelegramOperator

dag = DAG('example_telegram', start_date=datetime(2021, 1, 1), tags=['example'])
ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
DAG_ID = "example_telegram"
CONN_ID = "telegram_conn_id"
CHAT_ID = "-3222103937"

# [START howto_operator_telegram]
with DAG(DAG_ID, start_date=datetime(2021, 1, 1), tags=['example']) as dag:

send_message_telegram_task = TelegramOperator(
task_id='send_message_telegram',
telegram_conn_id='telegram_conn_id',
chat_id='-3222103937',
text='Hello from Airflow!',
dag=dag,
)
# [START howto_operator_telegram]

# [END howto_operator_telegram]
send_message_telegram_task = TelegramOperator(
task_id='send_message_telegram',
telegram_conn_id=CONN_ID,
chat_id=CHAT_ID,
text='Hello from Airflow!',
dag=dag,
)

# [END howto_operator_telegram]

from tests.system.utils import get_test_run # noqa: E402

# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest)
test_run = get_test_run(dag)