So I’m trying to make a telegram bot that can send images with captions underneath, but i want every that every photo has a different caption. I’ve been trying for a long time and this is what i have right now :
import requests
import time
base_url = "https://api.telegram.org/botnotgoingtodisplayforsafety/sendPhoto"
urls = [
"https://cdn.mos.cms.futurecdn.net/ASHH5bDmsp6wnK6mEfZdcU.jpg",
"https://hips.hearstapps.com/hmg-prod/images/small-fluffy-dog-breeds-maltipoo-66300ad363389.jpg?crop=0.668xw:1.00xh;0.151xw,0&resize=640:*",
"https://media-cldnry.s-nbcnews.com/image/upload/t_fit-760w,f_auto,q_auto:best/streams/2013/May/130522/6C7536084-g-hlt-120105-puppy-423p.jpg"
]
caps = ["1", "2", "3"
]
for url in urls:
time.sleep(1)
parameters = {
"chat_id" : "-notgoingtodisplayforsafety",
"photo" : url,
"caption" : caps
}
resp = requests.get(base_url, data = parameters)
print(resp.text)
So what the problem is now that it sends every image from the ‘urls’ list but it doesn’t use the ‘caps’ list. So it send the first image with caption : 1, then the second image with caption : 1 again and to forth. Does anyone now how i should be doing this and what im doing wrong?
I was trying to make a telegram bot that can send different images with different captions underneath.
Kunigami is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.