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

Method _do_post

src/telegram/_bot.py:721–753  ·  view source on GitHub ↗
(
        self,
        endpoint: str,
        data: JSONDict,
        *,
        read_timeout: ODVInput[float] = DEFAULT_NONE,
        write_timeout: ODVInput[float] = DEFAULT_NONE,
        connect_timeout: ODVInput[float] = DEFAULT_NONE,
        pool_timeout: ODVInput[float] = DEFAULT_NONE,
    )

Source from the content-addressed store, hash-verified

719 )
720
721 async def _do_post(
722 self,
723 endpoint: str,
724 data: JSONDict,
725 *,
726 read_timeout: ODVInput[float] = DEFAULT_NONE,
727 write_timeout: ODVInput[float] = DEFAULT_NONE,
728 connect_timeout: ODVInput[float] = DEFAULT_NONE,
729 pool_timeout: ODVInput[float] = DEFAULT_NONE,
730 ) -> bool | JSONDict | list[JSONDict]:
731 # This also converts datetimes into timestamps.
732 # We don't do this earlier so that _insert_defaults (see above) has a chance to convert
733 # to the default timezone in case this is called by ExtBot
734 request_data = RequestData(
735 parameters=[RequestParameter.from_input(key, value) for key, value in data.items()],
736 )
737
738 request = self._request[0] if endpoint == "getUpdates" else self._request[1]
739
740 self._LOGGER.debug("Calling Bot API endpoint `%s` with parameters `%s`", endpoint, data)
741 result = await request.post(
742 url=f"{self._base_url}/{endpoint}",
743 request_data=request_data,
744 read_timeout=read_timeout,
745 write_timeout=write_timeout,
746 connect_timeout=connect_timeout,
747 pool_timeout=pool_timeout,
748 )
749 self._LOGGER.debug(
750 "Call to Bot API endpoint `%s` finished with return value `%s`", endpoint, result
751 )
752
753 return result
754
755 async def _send_message(
756 self,

Callers 1

_postMethod · 0.95

Calls 3

RequestDataClass · 0.90
from_inputMethod · 0.80
postMethod · 0.45

Tested by

no test coverage detected