I'm trying to send 2 or 3 photos at the same time, so they're displayed as one message on my channel.
To send one photos I used python's requests
library, with this line of code;
pic = {'photo' : open('p.jpeg', 'rb')}
print(requests.get(f'https://api.telegram.org/bot{apiKey}/sendPhoto?chat_id={chat_id}?disable_notification=True', files=pic))
Now to send more at once I use telepot
. I'm doing this:
bot = telepot.Bot(apiKey)
bot.sendMediaGroup(
chat_id=chat_id,
media=[
{'media' : open( 'p.jpeg', 'rb')},
{'media' : open('p1.jpeg', 'rb')}
],
disable_notification=True
)
The problem is I don't precise the type of media being transferred. I tried doing :
media = {'media' :
{'photo' : open( 'p.jpeg', 'rb')},
{'photo' : open('p1.jpeg', 'rb')}
}
But media
parameter must be an array.
I also tried to pass a double sized dictionary as argument to requests.get(...)
, it didn't work either.
Could you guys help me out? Thank you
Well, problem solved, eventually I had to do this: