wsgi_proxy
— Python package of wsgi-proxy¶
This is an importable Python package that consists of basic WSGI app
and other frontends around it. The most important thing for you is
probably app
and its type WSGIProxyApplication
.
You can use this with other third-party WSGI servers. For example:
$ pip install gunicorn
$ gunicorn -p8080 wsgi_proxy:app
-
class
wsgi_proxy.
WSGIProxyApplication
¶ WSGI application to handle requests that need to be proxied. You have to instantiate the class before using it as WSGI app:
from wsgiref.simple_server import make_server app = WSGIProxyApplication() make_server('', 8080, app).serve_forever()
-
handler
(environ, start_response)¶ Proxy for requests to the actual http server
-
-
wsgi_proxy.
is_hop_by_hop
(header)¶ Returns
True
if the givenheader
is hop by hop.Parameters: header ( basestring
) – the header nameReturns: whether the given header
is hop by hop or notReturn type: bool
-
wsgi_proxy.
reconstruct_url
(environ)¶ Reconstruct the remote url from the given WSGI
environ
dictionary.Parameters: environ ( collections.MutableMapping
) – the WSGI environmentReturns: the remote url to proxy Return type: basestring
wsgi_proxy.cli
— wsgi-proxy command¶
-
-h
,
--help
¶
Print help message.
-
-p
<port>
,
--port
<port>
¶ The port number to listen. Default is 8080.
-
-H
<host>
,
--host
<host>
¶ The hostname to listen. Default is
127.0.0.1
.
-
--server
<server>
¶ The WSGI server implementation to use. Default is
waitress
.