Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
WSGI middleware to handle HTTP responses using exceptions
Python
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
httpexceptor
test
.gitignore
.travis.yml
LICENSE
Makefile
README
README.rst
setup.py

README.rst

httpexceptor build status

WSGI middleware to handle HTTP responses using exceptions

provides a group of exception classes representing non-2xx HTTP statuses, along with a WSGI middleware to turn the exceptions into proper HTTP headers

originally extracted from TiddlyWeb

source repository: https://github.com/tiddlyweb/httpexceptor

Usage

from httpexceptor import HTTPExceptor, HTTP404

# register middleware
app = HTTPExceptor(app)

# ...

if unavailable:
    raise HTTP404('resource unavailable')
Something went wrong with that request. Please try again.