Base¶
Abstract session for all client sessions
- class litegram.client.session.base.BaseSession(api: ~litegram.client.telegram.TelegramAPIServer = TelegramAPIServer(base='https://api.telegram.org/bot{token}/{method}', file='https://api.telegram.org/file/bot{token}/{path}', is_local=False, wrap_local_file=<litegram.client.telegram.BareFilesPathWrapper object>), json_loads: ~collections.abc.Callable[[...], ~typing.Any] = <function loads>, json_dumps: ~collections.abc.Callable[[...], str] = <function dumps>, timeout: float = 60.0)[исходный код]¶
This is base class for all HTTP sessions in litegram.
If you want to create your own session, you must inherit from this class.
- check_response(bot: Bot, method: TelegramMethod[TelegramType], status_code: int, content: str) Response[TelegramType][исходный код]¶
Check response status
- abstractmethod async close() None[исходный код]¶
Close client session
- abstractmethod async make_request(bot: Bot, method: TelegramMethod[TelegramType], timeout: int | None = None) TelegramType[исходный код]¶
Make request to Telegram Bot API
- Параметры:
bot – Bot instance
method – Method instance
timeout – Request timeout
- Результат:
- Исключение:
TelegramApiError –
- prepare_value(value: Any, bot: Bot, files: dict[str, Any], _dumps_json: bool = True) Any[исходный код]¶
Prepare value before send