telegram

URL = "https://api.telegram.org/bot%s/" % 650944065:AAFN_29nsPzVXt8s2HpAg17tB8HIATqHLJU MyURL = "https://example.com/hook"

api = requests.Session() application = tornado.web.Application([ (r"/", Handler), ])

if name == 'main': signal.signal(signal.SIGTERM, signal_term_handler) try: set_hook = api.get(URL + "setWebhook?url=%s" % MyURL) if set_hook.status_code != 200: logging.error("Can't set hook: %s. Quit." % set_hook.text) exit(1) application.listen(8888) tornado.ioloop.IOLoop.current().start() except KeyboardInterrupt: signal_term_handler(signal.SIGTERM, None)