0

I'm trying to send a photo with a telegram bot through sendPhoto method (https://core.telegram.org/bots/api#sendphoto) with telepot api, but it only accepts image urls with .jpg, .jpeg .gif, .png, .tif or .bmp and the photo I want to use is displayed through a .php url. How can I manage to obtain a valid url? I could also upload it using multipart/form-data but it's not working.

Mat13
  • 1
  • 2

1 Answers1

0

Nevermind, I managed to do it saving the file and uploading it with

urllib.request.urlretrieve("link.php", "./file.png")
bot.sendPhoto(chat_id, photo=open('./file.png', 'rb'))
Mat13
  • 1
  • 2