Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

bidirectional URI routing

Project Description
# biro

bidirectional URI routing

from biro import get, path_for, match

def list_article():

def show_article():

path_for(show_article, article_id=618) # /article/618
path_for(list_article, limit=10) # /article?limit=10

match('GET', "/article/309") # (article, {"article_id": "309"})
match('POST', "/article/309") # (None, None)

## the Router class

from biro import Router

router = Router()
router.append('DETELE', '/article/<article_id>', handler)

router.match('PATCH', '/path')
router.path_for(handler, q=val)

## wsgi example

from biro import get, match

def home():
return 'home'

def hello(name):
return 'hello %s' % name

def application(environ, start_response):
handler, params = match(environ['REQUEST_METHOD'].upper(),
if handler:
status = '200 OK'
response = handler(**params)
status = '404 Not Found'
response = 'page not found'
start_response(status, [('Content-Type', 'text/html; charset=utf-8')])
return [response.encode('utf-8')]

save it as, then it can be lunched using gunicorn like this:

$ gunicorn example:application
Release History

Release History

This version
History Node


History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
biro-0.0.4.tar.gz (3.0 kB) Copy SHA256 Checksum SHA256 Source Mar 19, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting