Input File

class bale.InputFile(file, *, file_name=None)

Bases: object

This object shows a file ready to send/upload.

Warning

Just for upload file, you can use “file_name” param.

Examples

Attachment Bot

# upload the file
with open('./my_file.png', 'rb') as f:
    file = InputFile(f.read())

# use the unique file id
file = InputFile("YOUR_FILE_ID")
Parameters:
  • file (io.BufferedReader | str | bytes) – Your File. Pass a file_id as String to send a file that exists on the Bale servers (recommended), pass an HTTP URL as a String for Bale to get a file from the Internet, or upload a new one.

  • file_name (Optional[str]) – Additional interface options. It is used only when uploading a file.