I'm trying to reshape my data, then create it like an image, using PIL
. After that I would like to send it without hands
a picture into a chat.
srcData = np.reshape(srcData, [row, col, height]) # reshape srcData
img = Image.fromarray(srcData)
url = 'https://api.telegram.org/file/bot<TOKEN>/sendPhoto/'
response = requests.get(url, stream=True)
with open('img.png', 'wb') as out_file:
shutil.copyfileobj(response.raw, out_file)
del response # HERE. I'm creating a picture into int a png file
f=open(out_file.name,'rb') #Trying to open
bot.send_photo(chat_id=chat_id, photo=f)# then send
I don't understand, why I have an error:
ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request.
Can you help me,please? I have no idea , what I should do. Please.