Skip to main content

Decorouter is a WSGI routing apparatus that makes it easy to define routes using decorator syntax.

Example:

from decorouter import Router

class MyApplication:
    router = Router()

    @router.add('/$')
    def index(self, environ, start_response):
        start_response('200 OK', [('Content-type', 'text/plain')])
        return ['Hello, world!']

    @router.add('/hello/([^/]+)$')
    def index(self, environ, start_response):
        args, kwargs = environ['wsgiorg.routing_args']
        (name,) = args
        start_response('200 OK', [('Content-type', 'text/plain')])
        return ['Hello, %s!' % (name,)]

    def __call__(self, environ, start_response):
        return self.router(environ, start_response)

if __name__ == '__main__':
    from wsgiref.simple_server import make_server
    make_server('', 8000, MyApplication()).serve_forever()

Release files for decorouter 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for decorouter 0.0.2
File Size Uploaded
decorouter-0.0.2.tar.gz 3.4 kB Details

Release files / decorouter-0.0.2.tar.gz

Download URL decorouter-0.0.2.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
318f77aedc3b04db3e9868c9d20195e8728650eaac27621b3ebb1d9d452067dd
BLAKE2b-256 checksum
How to use checksums
97ee40430afdb21012965bd197b3c7ec95444e8ebb84ebb9a4af516596028506
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page