telegram.InputFile

class telegram.InputFile(data)

Bases: object

This object represents a Telegram InputFile.

data

dict – Data containing an inputfile.

Parameters:data (dict) – Data containing an inputfile.
Raises:TelegramError
content_type

str – Content type

headers

dict – Headers.

static is_image(stream)

Check if the content file is an image by analyzing its headers.

Parameters:stream (str) – A str representing the content of a file.
Returns:The str mime-type of an image.
Return type:str
static is_inputfile(data)

Check if the request is a file request.

Parameters:data (Dict[str, str]) – A dict of (str, str) key/value pairs.
Returns:bool
to_form()

Transform the inputfile to multipart/form data.

Returns:str