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.2.4 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")],
"""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 #
- 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
- Wed Nov 2 19:32:08 CET 2011: improved error handling in digest.py and added qop=auth test
- Tue Nov 1 23:43:17 CET 2011: support gentoken without algo in digest.py
- Wed Jun 1 15:30:34 CEST 2011: added test cases and reworked AuthTokenGenerator class
- Wed Jun 1 15:01:14 CEST 2011: switched from darcs to git
- Wed Jan 12 21:41:27 CET 2011: released version 0.2.2 fixing dos and py2.6
contact #
You can mail to helmut@subdivi.de, but do not mail devnull@subdivi.de. Otherwise bug me (helmut) on Freenode or OFTC.