Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Decorators for WSGI without start_response and write

Project description

wsgistraw (WSGI without STart_Response And Write) is a tiny Python library that simplifies coding WSGI applications and middleware by removing start_response and write from signatures of functions. This leads to a signature like:

def app(environ):
    return "200 OK", [("Content-Type", "text/plain")], ["Hello World!"]

That is, return a three-tuple of (status, headers, response).

start_response and write are very annoying in WSGI middleware. wsgistraw makes your middleware code cleaner. This is an example of a “lowercase” middleware factory:

def lowercase(app):
    def mid(environ):
        status, headers, response = app(environ)
        return status, headers, (s.lower() for s in response)
    return mid

What’s New

A bugfix release. Fixed a bug in app_proxy with extending an iterable with the results of write().

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
wsgistraw-0.1.2-py2.4.egg (5.5 kB) Copy SHA256 hash SHA256 Egg 2.4 (16.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page