This module provides a basis for implementing WSGI applications that are automatically logged with slimta.logging.http.

class slimta.http.wsgi.WsgiServer([*args[, **kwargs]])

Bases: object

Implements the base class for a WSGI server that logs its requests and responses and can easily be deployed as a functioning HTTP server.

Instances of this class can be used as applications in WSGI server engines, or build_server() can be used.

build_server(listener[, pool=None[, ssl_args=None]])

Constructs and returns a WSGI server engine, configured to use the current object as its application.

  • listener – Usually a (ip, port) tuple defining the interface and port upon which to listen for connections.

  • pool – If given, defines a specific gevent.pool.Pool to use for new greenlets.

  • ssl_args – Optional dictionary of TLS settings, causing sockets to be encrypted on connection. See WSGIServer for details.

Return type


handle(environ, start_response)

Overridden by sub-classes to handle WSGI requests and generate a response. This method should be used as if it were the WSGI application function.

  • environ – The WSGI environment variables.

  • start_response – Call this function to initiate the WSGI response.


An iterable of raw data parts to return with the response.

__call__(environ, start_response)

When this object is used as a WSGI application, this method logs the request and ensures that the response will be logged as well. The request is then proxied to handle() for processing.


list of weak references to the object (if defined)