proxycommand
This implements the basic framework for making an HTTP proxy app from your filter.
The proxycommand module is accessible via the wsgifilter module.
This is the basic pattern:
def main(args=None):
if args is None:
args = sys.argv[1:]
parser = make_basic_optparse('MyPackage')
parser.add_option('--foo',
dest='foo')
options, args = parser.parse_args(args)
wsgi_middleware = make_my_foo_filter(
options.foo)
run_proxy_command(options, args, wsgi_middleware, parser)
Note that wsgi_middleware should be a callable that takes one argument (the application being wrapped) and returns a WSGI application that wraps the given application.
Functions
f make_basic_optparser(distro_name, help=None, usage='%prog [OPTIONS] REMOTE [SERVER]\n\n%(help)s') ...
Creates a parser that parses the options for the run_proxy() function. You may modify the parser this returns, to add option appropriate for building your WSGI middleware.
f run_proxy_command(options, args, wsgi_middleware, parser=None) ...
Run the proxy command, using the options and args and the WSGI middleware
f run_proxy(remote, server, wsgi_middleware, transparent=False, debug=0, request_log=0, rewrite=False) ...
See the source for more information.