how to send photo by telegram bot using multipart/form-data
multipartform-data, python, python-telegram-bot, telegram
Solution
Try this line of code
status = requests.post("https://api.telegram.org/bot<TOKEN>/sendPhoto?chat_id=" + data['chat_id'], files=files)
Problem
I have a telegram bot (developed in python) and i wanna to send/upload photo by it from images that are in my computer. so i should do it via multi part form data. but i don't know ho to do it. also i didn't find useful source for this on Internet and on telegram documentation . i tried to do that by below codes. but it was wrong ``` data = {'chat_id', chat_id} files = {'photo': open("./saved/{}.jpg".format(user_id), 'rb')} status = requests.post("https://api.telegram.org/bot<TOKEN>/sendPhoto", data=data, files=files) ``` can anyone help me?