I'm trying to upload a photo from my hard drive to the telegraph. In the documentation it says to use the upload_file():
telegraph.upload.upload_file(f) Upload file to Telegra.ph’s servers. Returns a list of links. Allowed only .jpg, .jpeg, .png, .gif and .mp4 files. Parameters: f (file, str or list) – filename or file-like object.
But I don't understand what "f (file, str or list) – filename or file-like object" means. That is, what do I need to do with the photo so that it can be passed to this function
my attempts to solve the problem:
upload_file(open('1.png', 'rb'))
error: telegraph.exceptions.TelegraphException: File type invalid
myf = io.StringIO()
myf.write(open(f'photo/{i}.png', 'rb'))
print(upload_file(myf))
myf.close()
error: TypeError: string argument expected, got '_io.BufferedReader'