Skip to content

Commit

Permalink
Elaborate on running the Application along other asyncio frameworks
Browse files Browse the repository at this point in the history
  • Loading branch information
Bibo-Joshi committed Oct 25, 2022
1 parent c3e336f commit 2227d88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions docs/source/inclusions/application_run_tip.rst
@@ -0,0 +1,7 @@
.. tip::
When combining ``python-telegram-bot`` with other :mod:`asyncio` based frameworks, using this
method is likely not the best choice, as it blocks the event loop until it receives a stop
signal as described above.
Instead, you can manually call the methods listed below to start and shut down the application
and the :attr:`~telegram.ext.Application.updater`.
Keeping the event loop running and listening for a stop signal is then up to you.
10 changes: 8 additions & 2 deletions telegram/ext/_application.py
Expand Up @@ -592,9 +592,12 @@ def run_polling(
If :attr:`post_shutdown` is set, it will be called after both :meth:`shutdown`
and :meth:`telegram.ext.Updater.shutdown`.
.. include:: inclusions/application_run_tip.rst
.. seealso::
:meth:`initialize`, :meth:`start`, :meth:`stop`, :meth:`shutdown`
:meth:`telegram.ext.Updater.start_polling`, :meth:`run_webhook`
:meth:`telegram.ext.Updater.start_polling`, :meth:`telegram.ext.Updater.stop`,
:meth:`run_webhook`
Args:
poll_interval (:obj:`float`, optional): Time to wait between polling updates from
Expand Down Expand Up @@ -705,9 +708,12 @@ def run_webhook(
If :attr:`post_shutdown` is set, it will be called after both :meth:`shutdown`
and :meth:`telegram.ext.Updater.shutdown`.
.. include:: inclusions/application_run_tip.rst
.. seealso::
:meth:`initialize`, :meth:`start`, :meth:`stop`, :meth:`shutdown`
:meth:`telegram.ext.Updater.start_webhook`, :meth:`run_polling`
:meth:`telegram.ext.Updater.start_webhook`, :meth:`telegram.ext.Updater.stop`,
:meth:`run_polling`
Args:
listen (:obj:`str`, optional): IP-Address to listen on. Defaults to
Expand Down

0 comments on commit 2227d88

Please sign in to comment.