Answer the question
In order to leave comments, you need to log in
What causes the 'Request Entity Too Large' error when sending an image to Telegram?
File size: 51.2 KB
Trying to send:
>>> send_img_url = 'https://api.telegram.org/botXXXXXXXXXXXXXXXXXXXXX/sendPhoto'
>>> img_name = 'C:/Users/Administrator/Downloads/WhatsApp Image 2019-05-30 at 20.54.40.jpeg'
>>> r = requests.post(send_img_url, data={'chat_id': '-351543550', 'photo': open(img_name, 'rb')})
>>> r
<Response [413]>
>>> r.reason
'Request Entity Too Large'
>>> r.content
b''
>>>
Answer the question
In order to leave comments, you need to log in
Because the files are sent wrong .
r = requests.post(send_img_url, data={'chat_id': '-351543550'}, files={"photo": open(img_name, 'rb')})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question