Fix error in webhook flask example

This commit is contained in:
Andrey Mishakin 2017-01-04 21:50:09 +03:00 committed by GitHub
parent 1215eee167
commit be87e4b2b9
1 changed files with 2 additions and 2 deletions

View File

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