telegram.InputFile¶
-
class
telegram.
InputFile
(obj: IO, filename: str = None, attach: bool = None)¶ Bases:
object
This object represents a Telegram InputFile.
-
input_file_content
¶ The binary content of the file to send.
Type: bytes
-
filename
¶ Optional. Filename for the file to be sent.
Type: str
-
attach
¶ Optional. Attach id for sending multiple files.
Type: str
Parameters: - obj (
File handler
) – An open file descriptor. - filename (
str
, optional) – Filename for this InputFile. - attach (
bool
, optional) – Whether this should be send as one file or is part of a collection of files.
Raises: TelegramError
-
static
is_image
(stream: bytes) → str¶ Check if the content file is an image by analyzing its headers.
Parameters: stream ( bytes
) – A byte stream representing the content of a file.Returns: The str mime-type of an image. Return type: str
-