telegram.InputFile¶
-
class
telegram.
InputFile
(obj, filename=None, attach=None)¶ Bases:
object
This object represents a Telegram InputFile.
- Parameters
obj (
File handler
|bytes
) – An open file descriptor or the files content as bytes.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
-
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
-
static
is_image
(stream)¶ 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 mime-type of an image, if the input is an image, or
None
else.- Return type
str
|None
-
to_dict
()¶