overview #
wsgitools is a set of tools working with WSGI (see PEP 333). It includes classes for filtering content, middlewares for caching, logging and tracebacks as well as two backends for SCGI. Goals in writing it were portability and simplicity.
getting wsgitools #
You can either download version 0.3.1 (signature) or get the latest version from the git repository. Just type git clone git://git.subdivi.de/~helmut/wsgitools.git. The source is also exported using gitweb.
documentation #
Modules are documented using docstrings, so there is an epydoc export.
example #
Most often a simple example is useful. Well here is one:
import sys from wsgitools.applications import StaticContent from wsgitools.middlewares import TracebackMiddleware from wsgitools.filters import WSGIFilterMiddleware, RequestLogWSGIFilter from wsgitools.scgi.asynchronous import SCGIServer app = StaticContent("200 OK", [("Content-type", "text/plain")], b"""Serving really simple static content as plaintext.""") # serve a traceback when catching exceptions app = TracebackMiddleware(app) # log requests in apache log file format to stdout app = WSGIFilterMiddleware(app, RequestLogWSGIFilter.creator(sys.stdout)) # run a scgi server on localhost:4000 server = SCGIServer(app, 4000) server.run()
recent changes #
- Tue Dec 6 19:37:32 CET 2022: fix incompatibility between digest and apache mod_proxy_scgi
- Wed Jul 7 14:06:41 CEST 2021: update irc networks
- Thu Apr 2 22:38:20 CEST 2020: initial steps towards type checking
- Tue Mar 10 15:58:42 CET 2020: release version 0.3.1: bug fixes
- Sat Apr 18 21:02:38 CEST 2015: release version 0.3: Python 3 support
- Thu Mar 14 13:55:25 CET 2013: release version 0.2.4
- Thu Aug 2 12:06:21 CEST 2012: added feature branch py3k for python 3.x support
- Sat Mar 17 22:19:03 CET 2012: support sendfile via wsgi.file_wrapper
- Thu Mar 15 16:02:02 CET 2012: added test cases and fixed issues with multiple calls to start_response
- Tue Dec 6 11:08:58 CET 2011: release version 0.2.3
contact #
You can mail to helmut@subdivi.de, but do not mail devnull@subdivi.de. Otherwise bug me (helmut) on libera.chat or OFTC.