prologin.web module

Provides utilities for Prologin web applications. Everything should be prologinized like this:

# WSGI application import prologin.web application = prologin.web.WsgiApp(application, ‘app_name’)

# Tornado application import prologin.web application = prologin.web.TornadoApp(handlers, ‘app_name’)

# BaseHTTPServer application class MyRequestHandler(prologin.web.ProloginBaseHTTPRequestHandler):

This initializes logging using prologin.log, and maps some special URLs to useful pages:

  • /__ping Should always return the string “pong”. Used for health checking.

  • /__threads Shows the status of all threads in the process and their current stack.

  • [TODO] /__monitoring Exports monitoring values for outside use.

class prologin.web.AiohttpApp(routes, app_name, **kwargs)

Bases: object

add_wsgi_app(wsgi_app)
run(**kwargs)
class prologin.web.TornadoApp(handlers, app_name)

Bases: tornado.web.Application

get_special_handler(handler_func)

Wrap a special handler into a Tornado-compatible handler class.

class prologin.web.WsgiApp(app, app_name)

Bases: object

call_handler(environ, start_response, handler)
prologin.web.exceptions_catched(func)

Decorator for function handlers: return a HTTP 500 error when an exception is raised.

prologin.web.ping_handler()
prologin.web.threads_handler()