1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Fix the bug that the return of request.get_data() is not string.

This commit is contained in:
Ubuntu 2016-05-02 11:07:23 +00:00
parent bd513cd343
commit 5906d632d6

View File

@ -48,7 +48,7 @@ def index():
@app.route(WEBHOOK_URL_PATH, methods=['POST']) @app.route(WEBHOOK_URL_PATH, methods=['POST'])
def webhook(): def webhook():
if flask.request.headers.get('content-type') == 'application/json': if flask.request.headers.get('content-type') == 'application/json':
json_string = flask.request.get_data() json_string = flask.request.get_data().decode('utf-8')
update = telebot.types.Update.de_json(json_string) update = telebot.types.Update.de_json(json_string)
bot.process_new_messages([update.message]) bot.process_new_messages([update.message])
return '' return ''