X Tutup
Skip to content

BadRequest message has wrong format (u"Bad Request: ...") #470

@millerlogic

Description

@millerlogic

Steps to reproduce

  1. Create an Updater with a valid bot token.

  2. Call bot.sendMessage which will raise a BadRequest, such as with parse_mode="HTML" and text="<b>" (unclosed tag)

  3. Catch the exception and read it. except BadRequest as e: look_at(e.message)

Expected behaviour

BadRequest message should say: Can't parse message text: Can't found end tag corresponding to start tag at byte offset 0

Actual behaviour

BadReqeust message actually says: u"Bad Request: Can't parse message text: Can't found end tag corresponding to start tag at byte offset 0" (notice it's literally surrounded with u" ")

Configuration

Operating System:
Debian

Version of Python, python-telegram-bot & dependencies:

$ python -m telegram
python-telegram-bot 5.2.0
urllib3 1.19.1
certifi 2016.09.26
future 0.16.0
Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2]

Notes

Notice the repr(message):

https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/utils/request.py#L152

Should the repr call be removed, or should message have another format?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup