Skip to main content

Tort - Tornado framework helper functions

Project description

Tort

Tornado framework helpers.

Requires Python 3.7+ as it uses contextvars and Tornado 6+.

Use cases

Add Request Id to all requests

    import logging
    import tornado.ioloop
    import tornado.web
    from tort.logger import configure_logging

    class MainHandler(tornado.web.RequestHandler):
        def get(self):
            self.write("Hello, world")

    def make_app():
        configure_logging('/tmp/logs_with_request_id.txt', logging.DEBUG)

        return tornado.web.Application([
            (r"/", MainHandler),
        ])

    if __name__ == "__main__":
        app = make_app()
        app.listen(8888)
        tornado.ioloop.IOLoop.current().start()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tort-0.5.9.tar.gz (8.7 kB view hashes)

Uploaded Source

Built Distribution

tort-0.5.9-py3-none-any.whl (10.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page