Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
super(MltshpApplication, self).__init__(*args, **settings)
if __name__ == "__main__":
mltshpoptions.parse_dictionary(settings)
tornado.options.parse_command_line()
if options.dump_settings:
from pprint import pprint
pprint({'options': dict((k, opt.value())
for k, opt in options.iteritems()),
'app_settings': app_settings})
sys.exit(0)
app_settings = MltshpApplication.app_settings()
application = MltshpApplication(routes, autoescape=None, **app_settings)
http_server = tornado.httpserver.HTTPServer(application)
print "starting on port %s" % (options.on_port)
http_server.listen(int(options.on_port))
tornado.ioloop.IOLoop.instance().start()
enable_pretty_logging()
class HomeHdr(RequestHandler):
def get(self):
return self.write('yes')
class RPCHdr(JSONRPCHandler):
def add(self, x, y):
return x + y
def err(self):
return self
http_server = HTTPServer(Application([(r'/', HomeHdr), (r'/rpc', RPCHdr)], debug=True))
http_server.listen(10001)
io_loop = IOLoop.instance()
io_loop.start()
stats['uptime'] = time.time() - psutil.boot_time()
stats['fqdn'] = socket.gethostname()
stats['cpuusage'] = psutil.cpu_percent(0)
stats['ramusage'] = psutil.virtual_memory()
stats['diskio'] = psutil.disk_io_counters()
stats['diskusage'] = [diskused, disktotal]
stats['netio'] = psutil.net_io_counters()
stats['swapusage'] = psutil.swap_memory()
time.sleep(1)
if __name__ == '__main__':
stats = Manager().dict()
Process(target=update, args=(stats, )).start()
if len(sys.argv) > 1:
PORT = sys.argv[1]
server = HTTPServer(WSGIContainer(app))
print 'Now listening on port ' + str(PORT)
server.listen(PORT)
IOLoop.instance().start()
response = twitter.get_user_timeline(
screen_name=self.get_argument('screen_name'),
count=200)
generator = CharacterMarkovGenerator(options.n, 140)
for tweet in response:
generator.feed(tweet['text'])
self.write(generator.generate())
static_path = os.path.join(os.path.dirname(__file__), "static")
template_path = os.path.join(os.path.dirname(__file__), "templates")
application = tornado.web.Application(
handlers=[(r"/", IndexHandler), (r"/markov", MarkovHandler)],
static_path=static_path,
template_path=template_path)
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
except:
print 'Error: Please install tornado first'
return
if options.ssl:
ctx = {
"certfile": options.ssl_cert,
"keyfile": options.ssl_key,
}
log.info(' * Running on https://%s:%d/' % (options.hostname, options.port))
else:
ctx = None
log.info(' * Running on http://%s:%d/' % (options.hostname, options.port))
container = tornado.wsgi.WSGIContainer(get_app())
http_server = tornado.httpserver.HTTPServer(container,
ssl_options=ctx)
http_server.listen(options.port, address=options.hostname)
loop=tornado.ioloop.IOLoop.instance()
if options.reload:
for f in extra_files:
tornado.autoreload.watch(f)
tornado.autoreload.start(loop)
loop.start()
def main():
tornado.options.parse_command_line()
http_server = tornado.httpserver.HTTPServer(Application())
http_server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
import tornado.httpserver
import tornado.ioloop
import tornado.options
import logging
tornado.options.define("port", default=PPCONSOLE_ADMIN_PORT, help="", type=int)
if __name__ == "__main__":
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
tornado.options.parse_command_line()
_app = App("admin")
http_server = tornado.httpserver.HTTPServer(_app)
logging.info("Starting ppconsole of admin... with port: %d" % tornado.options.options.port)
http_server.listen(tornado.options.options.port)
loop = tornado.ioloop.IOLoop.instance()
loop.start()
from ppmessage.core.constant import FILEUPLOAD_PORT
import tornado.httpserver
import tornado.ioloop
import tornado.options
import logging
tornado.options.define("port", default=FILEUPLOAD_PORT, help="", type=int)
if __name__ == "__main__":
tornado.options.parse_command_line()
_app = UploadApplication()
_http_server = tornado.httpserver.HTTPServer(_app)
logging.info("Starting Upload servcie.")
_http_server.listen(tornado.options.options.port)
loop = tornado.ioloop.IOLoop.instance()
loop.start()
def launch():
tornado.locale.load_translations(options.web_server['locale_path'])
tornado.options.parse_command_line()
http_server = tornado.httpserver.HTTPServer(application, xheaders=True)
http_server.listen(options.port)
logger.info('Server started on %s' % options.port)
tornado.ioloop.IOLoop.instance().start()