Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. if __name__ == '__main__':
  2.     if ARGS['production'] == True:
  3.         print(ARGS['production'])
  4.         bot.remove_webhook()
  5.         bot.set_webhook(url=WEBHOOK_URL_BASE + WEBHOOK_URL_PATH,
  6.                         certificate=open(WEBHOOK_SSL_CERT, 'r'))
  7.  
  8.         # settings for cherrypy server
  9.         cherrypy.config.update({
  10.             'server.socket_host': WEBHOOK_LISTEN,
  11.             'server.socket_port': WEBHOOK_PORT,
  12.             'server.ssl_module': 'builtin',
  13.             'server.ssl_certificate': WEBHOOK_SSL_CERT,
  14.             'server.ssl_private_key': WEBHOOK_SSL_PRIV,
  15.         })
  16.  
  17.         # daemonize so process runs in background.
  18.         from cherrypy.process.plugins import Daemonizer
  19.         d = Daemonizer(cherrypy.engine)
  20.         d.subscribe()
  21.         # launch!
  22.         cherrypy.quickstart(WebhookServer(), WEBHOOK_URL_PATH, {'/': {}})
  23.     else:
  24.         bot.remove_webhook()
  25.         bot.polling()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement