def pyro_app(environ, start_response):
"""
The WSGI app function that is used to process the requests.
You can stick this into a wsgi server of your choice, or use the main() method
to use the default wsgiref server.
"""
config.SERIALIZER = "json" # we only talk json through the http proxy
config.COMMTIMEOUT = pyro_app.comm_timeout
method = environ.get("REQUEST_METHOD")
path = environ.get('PATH_INFO', '').lstrip('/')
if not path:
return redirect(start_response, "/pyro/")
if path.startswith("pyro/"):
if method in ("GET", "POST"):
parameters = singlyfy_parameters(cgi.parse(environ['wsgi.input'], environ))
return process_pyro_request(environ, path[5:], parameters, start_response)
else:
return invalid_request(start_response)
return not_found(start_response)
评论列表
文章目录