Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Telegram example DAGs to new design AIP-47 #24135

Closed
wants to merge 1 commit into from
Closed
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/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 @@ -18,22 +18,31 @@
"""
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'

dag = DAG(DAG_ID, start_date=datetime(2021, 1, 1), tags=['example'])

# [START howto_operator_telegram]

send_message_telegram_task = TelegramOperator(
task_id='send_message_telegram',
telegram_conn_id='telegram_conn_id',
telegram_conn_id=CONN_ID,
chat_id='-3222103937',
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)