wsgiref.handlers.CGIHandler

class wsgiref.handlers.CGIHandler CGI-based invocation via sys.stdin, sys.stdout, sys.stderr and os.environ. This is useful when you have a WSGI application and want to run it as a CGI script. Simply invoke CGIHandler().run(app), where app is the WSGI application object you wish to invoke. This class is a subclass of BaseCGIHandler that sets wsgi.run_once to true, wsgi.multithread to false, and wsgi.multiprocess to true, and always uses sys and os to obtain the necessary CGI streams and envi

wsgiref.handlers.BaseHandler._write()

_write(data) Buffer the bytes data for transmission to the client. It’s okay if this method actually transmits the data; BaseHandler just separates write and flush operations for greater efficiency when the underlying system actually has such a distinction.

wsgiref.handlers.BaseHandler._flush()

_flush() Force buffered data to be transmitted to the client. It’s okay if this method is a no-op (i.e., if _write() actually sends the data).

wsgiref.handlers.BaseHandler.wsgi_run_once

wsgi_run_once The value to be used for the wsgi.run_once environment variable. It defaults to false in BaseHandler, but CGIHandler sets it to true by default.

wsgiref.handlers.BaseHandler.wsgi_multithread

wsgi_multithread The value to be used for the wsgi.multithread environment variable. It defaults to true in BaseHandler, but may have a different default (or be set by the constructor) in the other subclasses.

wsgiref.handlers.BaseHandler.wsgi_multiprocess

wsgi_multiprocess The value to be used for the wsgi.multiprocess environment variable. It defaults to true in BaseHandler, but may have a different default (or be set by the constructor) in the other subclasses.

wsgiref.handlers.BaseHandler.wsgi_file_wrapper

wsgi_file_wrapper A wsgi.file_wrapper factory, or None. The default value of this attribute is the wsgiref.util.FileWrapper class.

wsgiref.handlers.BaseHandler.traceback_limit

traceback_limit The maximum number of frames to include in tracebacks output by the default log_exception() method. If None, all frames are included.

wsgiref.handlers.BaseHandler.setup_environ()

setup_environ() Set the environ attribute to a fully-populated WSGI environment. The default implementation uses all of the above methods and attributes, plus the get_stdin(), get_stderr(), and add_cgi_vars() methods and the wsgi_file_wrapper attribute. It also inserts a SERVER_SOFTWARE key if not present, as long as the origin_server attribute is a true value and the server_software attribute is set.

wsgiref.handlers.BaseHandler.server_software

server_software If the origin_server attribute is set, this attribute’s value is used to set the default SERVER_SOFTWARE WSGI environment variable, and also to set a default Server: header in HTTP responses. It is ignored for handlers (such as BaseCGIHandler and CGIHandler) that are not HTTP origin servers. Changed in version 3.3: The term “Python” is replaced with implementation specific term like “CPython”, “Jython” etc.