Skip to main content

simplerouter is a simple WSGI/WebOb router partially based on the router described in WebOb’s DIY Framework Tutorial. Python 2.7 and Python 3.2 and newer are supported.

Documentation is available at readthedocs.org.

The main git repository is available at Bitbucket.

Installing

simplerouter uses a setup.py script in the usual fashion, like so:

$ python ./setup.py install

Alternately, simplerouter is available on pypi and can be installed using pip:

$ pip install simplerouter

Quick Example

app.py:

from simplerouter import Router

router = Router()
# view names are composed of modulename:function
router.add_route('/post/{name}', 'views:post_view')
router.add_route('/', 'views:index_view')

application = router.as_wsgi

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

views.py:

from webob import Response

def post_view(request):
    post_name = request.urlvars['name']
    # ... process post_name
    return Response("Post output for %s"%post_name)

def index_view(request):
    return Response("Site index")

Release files for simplerouter 1.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 simplerouter 1.2
File Size Uploaded
simplerouter-1.2.tar.gz 11.1 kB Details

Release files / simplerouter-1.2.tar.gz

Download URL simplerouter-1.2.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1cbdc0dd87aa19b3fd8ab1444fd70df6eed0328080f600ed20832c0fc7826a86
BLAKE2b-256 checksum
How to use checksums
1023ae4dbaf49186503b8aaffed102f053fef88531aa53417aeac497e86ef203
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.2 This release

1 release file

1.1.1

1 release file

1.1

1 release file

1.0

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