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

Method _post

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

Source from the content-addressed store, hash-verified

684 data[key] = DefaultValue.get_value(val)
685
686 async def _post(
687 self,
688 endpoint: str,
689 data: JSONDict | None = None,
690 *,
691 read_timeout: ODVInput[float] = DEFAULT_NONE,
692 write_timeout: ODVInput[float] = DEFAULT_NONE,
693 connect_timeout: ODVInput[float] = DEFAULT_NONE,
694 pool_timeout: ODVInput[float] = DEFAULT_NONE,
695 api_kwargs: JSONDict | None = None,
696 ) -> Any:
697 # We know that the return type is Union[bool, JSONDict, list[JSONDict]], but it's hard
698 # to tell mypy which methods expects which of these return values and `Any` saves us a
699 # lot of `type: ignore` comments
700 if data is None:
701 data = {}
702
703 if api_kwargs:
704 data.update(api_kwargs)
705
706 # Insert is in-place, so no return value for data
707 self._insert_defaults(data)
708
709 # Drop any None values because Telegram doesn't handle them well
710 data = {key: value for key, value in data.items() if value is not None}
711
712 return await self._do_post(
713 endpoint=endpoint,
714 data=data,
715 read_timeout=read_timeout,
716 write_timeout=write_timeout,
717 connect_timeout=connect_timeout,
718 pool_timeout=pool_timeout,
719 )
720
721 async def _do_post(
722 self,

Callers 15

_send_messageMethod · 0.95
do_api_requestMethod · 0.95
get_meMethod · 0.95
delete_messageMethod · 0.95
delete_messagesMethod · 0.95
forward_messagesMethod · 0.95
send_media_groupMethod · 0.95
send_chat_actionMethod · 0.95
answer_inline_queryMethod · 0.95
get_fileMethod · 0.95

Calls 3

_insert_defaultsMethod · 0.95
_do_postMethod · 0.95
updateMethod · 0.80

Tested by

no test coverage detected