def webhook(): """ Route для прослуховування вхідних запитів від телеграму. Використовується, якщо бот запущений через start_bot_weebook() :return: """ update = types.Update.de_json(request.stream.read().decode('utf-8')) bot.process_new_updates([update]) return 'ok', 200
def index(self): if 'content-length' in cherrypy.request.headers and \ 'content-type' in cherrypy.request.headers and \ cherrypy.request.headers['content-type'] == 'application/json': length = int(cherrypy.request.headers['content-length']) json_string = cherrypy.request.body.read(length).decode("utf-8") update = telebot.types.Update.de_json(json_string) bot.process_new_updates([update]) return '' else: raise cherrypy.HTTPError(403)
def webhook(): """ Function process webhook call """ if request.headers.get('content-type') == 'application/json': json_string = request.get_data().decode('utf-8') update = Update.de_json(json_string) bot.process_new_updates([update]) return '' else: abort(403)
def getMessage(): bot.process_new_updates([ telebot.types.Update.de_json( request.stream.read().decode("utf-8")) ]) return "!", 200
def getMessage(): request_object = request.stream.read().decode("utf-8") update_to_json = [telebot.types.Update.de_json(request_object)] bot.process_new_updates(update_to_json) return "got Message bro"
def index(self): length = int(cherrypy.request.headers['content-length']) json_string = cherrypy.request.body.read(length).decode("utf-8") update = telebot.types.Update.de_json(json_string) bot.process_new_updates([update]) return ''