telegram.InputFile#
- class telegram.InputFile(obj, filename=None, attach=False)[source]#
Bases:
object
This object represents a Telegram InputFile.
Changed in version 20.0: The former attribute
attach
was renamed toattach_name
.- Parameters
obj (file object |
bytes
|str
) –An open file descriptor or the files content as bytes or string.
Note
If
obj
is a string, it will be encoded as bytes viaobj.encode('utf-8')
.Changed in version 20.0: Accept string input.
attach (
bool
, optional) – PassTrue
if the parameter this file belongs to in the request to Telegram should point to the multipart data via anattach://
URI. Defaults to False.
- attach_name[source]#
Optional. If present, the parameter this file belongs to in the request to Telegram should point to the multipart data via a an URI of the form
attach://<attach_name>
URI.- Type
- property attach_uri[source]#
URI to insert into the JSON data for uploading the file. Returns
None
, ifattach_name
isNone
.