Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class WebhookServer(object):
- @cherrypy.expose
- 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 ''
- #bot.polling(none_stop=True)
- if __name__ == '__main__':
- bot.remove_webhook()
- bot.set_webhook("https://name.ru/AAAA")
- cherrypy.config.update({
- 'server.socket_host': '127.0.0.1',
- 'server.socket_port': 7771,
- 'engine.autoreload.on': False
- })
- cherrypy.quickstart(WebhookServer(), '/', {'/': {}})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement