Tornadoproxyhandlers Documentation
Total Page:16
File Type:pdf, Size:1020Kb
tornadoproxyhandlersDocumentation Release 0.0.5 Tim Paine Oct 15, 2020 Contents 1 Install 3 2 Overview 5 3 Use 7 4 API Documentation 9 Python Module Index 11 Index 13 i ii tornadoproxyhandlersDocumentation; Release0:0:5 Tornado proxy handlers for HTTP requests and web sockets Build Status Coverage License PyPI Docs Contents 1 tornadoproxyhandlersDocumentation; Release0:0:5 2 Contents CHAPTER 1 Install pip install tornado-proxy-handlers or from source python setup.py install 3 tornadoproxyhandlersDocumentation; Release0:0:5 4 Chapter 1. Install CHAPTER 2 Overview This project contains 2 proxy handlers: • HTTP Handler • Websocket Handler The websocket handler requires the http handler for 599 protocol switching. 5 tornadoproxyhandlersDocumentation; Release0:0:5 6 Chapter 2. Overview CHAPTER 3 Use These are designed to be embedded in a tornado server that needs to proxy. They can also be run as a standalone proxy server via the tornado-proxy command. 7 tornadoproxyhandlersDocumentation; Release0:0:5 8 Chapter 3. Use CHAPTER 4 API Documentation class tornado_proxy_handlers.handlers.ProxyHandler(application: tor- nado.web.Application, request: tor- nado.httputil.HTTPServerRequest, **kwargs) Bases: tornado.web.RequestHandler get(url=None) Get the login page initialize(proxy_url=’/’, **kwargs) class tornado_proxy_handlers.handlers.ProxyWSHandler(application: tor- nado.web.Application, request: tor- nado.httputil.HTTPServerRequest, **kwargs) Bases: tornado.websocket.WebSocketHandler initialize(proxy_url=’/’, **kwargs) on_close() Invoked when the WebSocket is closed. If the connection was closed cleanly and a status code or reason phrase was supplied, these values will be available as the attributes self.close_code and self.close_reason. Changed in version 4.0: Added close_code and close_reason attributes. on_message(message) Handle incoming messages on the WebSocket This method must be overridden. Changed in version 4.5: on_message can be a coroutine. open(url=None) Invoked when a new WebSocket is opened. 9 tornadoproxyhandlersDocumentation; Release0:0:5 The arguments to open are extracted from the tornado.web.URLSpec regular expression, just like the argu- ments to tornado.web.RequestHandler.get. open may be a coroutine. on_message will not be called until open has returned. Changed in version 5.1: open may be a coroutine. tornado_proxy_handlers.server.main(proxy_url) 10 Chapter 4. API Documentation Python Module Index t tornado_proxy_handlers,9 tornado_proxy_handlers.handlers,9 tornado_proxy_handlers.server, 10 11 tornadoproxyhandlersDocumentation; Release0:0:5 12 Python Module Index Index G get() (tornado_proxy_handlers.handlers.ProxyHandler method),9 I initialize() (tornado_proxy_handlers.handlers.ProxyHandler method),9 initialize() (tornado_proxy_handlers.handlers.ProxyWSHandler method),9 M main() (in module tornado_proxy_handlers.server), 10 O on_close() (tornado_proxy_handlers.handlers.ProxyWSHandler method),9 on_message() (tornado_proxy_handlers.handlers.ProxyWSHandler method),9 open() (tornado_proxy_handlers.handlers.ProxyWSHandler method),9 P ProxyHandler (class in tor- nado_proxy_handlers.handlers),9 ProxyWSHandler (class in tor- nado_proxy_handlers.handlers),9 T tornado_proxy_handlers (module),9 tornado_proxy_handlers.handlers (module), 9 tornado_proxy_handlers.server (module), 10 13.