The issue is caused by the way you pass the parse_mode.
In your url there is:
&parseMode=MarkdownV2
But that should be
&parse_mode=MarkdownV2
After changing that, it works as expected with the following url/code/output:
https://api.telegram.org/bot<TOKEN>/sendPhoto?chat_id=<CHAT-ID>&parse_mode=MarkdownV2&photo=http://placehold.jp/150x150.png&caption=*Foo*Bar
import requests
chatID='my-chat-id'
link='http://placehold.jp/150x150.png'
token='my-private-token'
caption='Example text'
telegram_msg = requests.get(f'https://api.telegram.org/bot{token}/sendPhoto?chat_id={chatID}&parse_mode=MarkdownV2&photo={link}&caption=*{caption}*')
Note: Make sure you're using Python 3.6 or above to use f
strings:
How do I put a variable’s value inside a string?
