【发布时间】:2017-10-05 09:15:11
【问题描述】:
我从python telegram bot 的文件发送照片时遇到问题。 它适用于图片 URL,但在尝试从磁盘发送文件时效果不佳。
重现步骤
bot.send_photo(chat_id=update.message.chat_id, photo=open('/mydir/log.jpg', 'rb'))
出现错误:
*** BadRequest: Url host is empty
配置
操作系统:Osx
Python:2.7 蟒蛇
-
-m 电报
- _python-telegram-bot 8.0
- 证书 2017.07.27.1
- 未来 0.16.0
- Python 2.7.13(默认,2016 年 12 月 18 日,07:03:39)[GCC 4.2.1 兼容 Apple LLVM 8.0.0 (clang-800.0.42.1)]_
根据文档,我们可以从磁盘传递文件: https://github.com/python-telegram-bot/python-telegram-bot/wiki/Code-snippets#post-an-image-file-from-disk
【问题讨论】:
标签: python-2.7 telegram python-telegram-bot