MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / shutdown

Method shutdown

src/telegram/_bot.py:870–884  ·  view source on GitHub ↗

Stop & clear resources used by this class. Currently just calls :meth:`telegram.request.BaseRequest.shutdown` for the request objects used by this bot. .. seealso:: :meth:`initialize` .. versionadded:: 20.0

(self)

Source from the content-addressed store, hash-verified

868 raise InvalidToken(f"The token `{self._token}` was rejected by the server.") from exc
869
870 async def shutdown(self) -> None:
871 """Stop & clear resources used by this class. Currently just calls
872 :meth:`telegram.request.BaseRequest.shutdown` for the request objects used by this bot.
873
874 .. seealso:: :meth:`initialize`
875
876 .. versionadded:: 20.0
877 """
878 if not self._requests_initialized:
879 self._LOGGER.debug("This Bot is already shut down. Returning.")
880 return
881
882 await asyncio.gather(self._request[0].shutdown(), self._request[1].shutdown())
883 self._requests_initialized = False
884 self._bot_initialized = False
885
886 async def do_api_request(
887 self,

Callers 2

__aenter__Method · 0.95
__aexit__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected