【发布时间】:2019-05-14 21:41:40
【问题描述】:
我正在使用 api.telegram.bot 和 requests 发送消息和图像。
requests.get(url + 'sendMessage', params=dict(chat_id=send_to_user_id,text="Messo"))
这工作正常。我的电报用户能够收到消息“Messo”。
现在,我正在尝试使用 sendPhoto 发送我在本地驱动器上托管的图像。
path = "kings/test_screenie1.png"
requests.get(url + 'sendPhoto', params=dict(chat_id=send_to_user_id, photo=open(path,'rb')))
我没有收到任何异常,但是,我的用户没有收到图像。我在 Jupyter notebook 中得到的输出是:<Response [414]>
运行此代码的我的 .ipynb 文件位于:/Users/abc/Desktop/webproject/play0.ipynb
我的图片文件位于:/Users/abc/Desktop/webproject/kings/test_screenie1.png
我在 Mac OS 上运行它。
【问题讨论】:
标签: python telegram telegram-bot python-telegram-bot