The server is provided in WSGIServer, but most of the actual WSGI work is handled by WSGIHandler — a new instance is created for each request. The server can be customized to use different subclasses of WSGIHandler.
Bases: object
alias of Message
The main request handling method, called by the server.
This method runs until all requests on the connection have been handled (that is, it implements pipelining).
Process the incoming request. Parse various headers.
| Raises ValueError: | |
|---|---|
| If the request is invalid. This error will not be logged (because it’s a client issue, not a server problem). | |
Read and return the HTTP request line.
Under both Python 2 and 3, this should return the native str type; under Python 3, this probably means the bytes read from the network need to be decoded (using the ISO-8859-1 charset, aka latin-1).
Bases: gevent.server.StreamServer
A WSGI server based on StreamServer that supports HTTPS.
| Parameters: |
|
|---|
See also
Changed in version 1.1a3: Added the error_log parameter, and set wsgi.errors in the WSGI environment to this value.
Changed in version 1.1a3: Add support for passing logging.Logger objects to the log and error_log arguments.
The object to which error logs will be written. It will never be None.
alias of WSGIHandler
The object to which request logs will be written. It will never be None.
Called before the first request is handled to fill in WSGI environment values.
This includes getting the correct server name and port.
Create an instance of handler_class to handle the request.
This method blocks until the handler returns.
Bases: object
An adapter for logging.Logger instances to let them be used with WSGIServer.
Warning
Unless the entire process is monkey-patched at a very early part of the lifecycle (before logging is configured), loggers are likely to not be gevent-cooperative. For example, the socket and syslog handlers use the socket module in a way that can block, and most handlers acquire threading locks.
Warning
It may be possible for the logging functions to be called in the gevent.Hub greenlet. Code running in the hub greenlet cannot use any gevent blocking functions without triggering a LoopExit.
New in version 1.1a3.
Write information to the logger at the given level (default to INFO).
No-op; required to be a file-like object
Next page: gevent.wsgi – Backwards compatibility alias for gevent.pywsgi