Firstly, It is sendPhoto
not sendphoto
.
Here is the link for docs for your reference.
Notice that you are giving the url for post requets as:
https://api.telegram.org/bot"+token+"/sendphoto?chat_id="+chat_id+"&photo="+pic
but it actually should be https://api.telegram.org/bot"+token+"/sendPhoto?chat_id="+chat_id+"&photo="+pic
Secondly, you are trying to send a locally hosted image. Its a bit different to send locally hosted images than to send the URLs for online images.
You have to send the image file as a dictionary along with the post request like this:
import requests
img = open(your/local/image, 'rb')
TOKEN =
CHAT_ID =
url = f'https://api.telegram.org/bot{TOKEN}/sendPhoto?chat_id={CHAT_ID}'
print(requests.post(url, files={'photo': img}))
Output:
<Response [200]>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…