Answer the question
In order to leave comments, you need to log in
How to send a photo via telegram api?
Good afternoon.
I'm trying to teach a bot to send photos.
def send_photo(chat_id, photo):
url = URL + 'sendPhoto'
answer = {'chat_id':chat_id, 'photo':photo}
r = requests.post(url, json=answer)
return r.json()
f = open("C:\\Python37\\project\\photo\\1.jpg", 'rb')
send_photo(chat_id, f)
Answer the question
In order to leave comments, you need to log in
What library are you using?
import telebot
from telebot import types
img = open(imageFile, 'rb')
bot.send_photo(chatID, img, caption=TEST)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question