Python-telegram-bot: Send image from URL

Created on 23 Aug 2016  路  4Comments  路  Source: python-telegram-bot/python-telegram-bot

Steps to reproduce

N/A

Expected behaviour

I'd like to see a way to send a photo from a given URL, either through sendPhoto or a new function

Actual behaviour

Right now, you can't (easily), resulting in weird errors

Configuration

Operating System:
Ubuntu 14.04 and 16.04

Version of Python, python-telegram-bot & dependencies:
2.7, 4.2.1 (but this is a version-independent feature request)

$ python -m telegram
/usr/bin/python: No module named telegram.__main__; 'telegram' is a package and cannot be directly executed

Logs

N/A

All 4 comments

_If_ we _do_ add this, we should definitely do it for all the send_* methods, not just photo.

From the Wiki:

To post a file from an URL, this library offers a shortcut. You can pass the URL of the file, instead of downloading the file first. If you do that, the file will be downloaded and directly streamed into the response to Telegram.

>>> bot.sendPhoto(chat_id=chat_id, photo='https://telegram.org/img/t_logo.png')

Is this maybe what you want?

@jh0ker Oh .-.
On another note, should the wiki be updated to use snake_case names instead of camelCase?

@bomjacob Please open a new issue, as I'm going to close this one. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xoancosmed picture xoancosmed  路  3Comments

psytron picture psytron  路  4Comments

marekyggdrasil picture marekyggdrasil  路  5Comments

YHporkar picture YHporkar  路  3Comments

left4taco picture left4taco  路  3Comments