Skip to main content
# biro

bidirectional URI routing

```python
from biro import get, path_for, match

@get('/article')
def list_article():
pass

@get('/article/<article_id>')
def show_article():
pass

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

```python
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

```python
from biro import get, match

@get('/')
def home():
return 'home'

@get('/hello/<name>')
def hello(name):
return 'hello %s' % name

def application(environ, start_response):
handler, params = match(environ['REQUEST_METHOD'].upper(),
environ['PATH_INFO'])
if handler:
status = '200 OK'
response = handler(**params)
else:
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 example.py, then it can be lunched using gunicorn like this:

```
$ gunicorn example:application
```

Metadata

Release files for biro 0.0.3

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

Source distribution (sdist)

Source distribution for biro 0.0.3
File Size Uploaded Provenance Actions
biro-0.0.3.tar.gz 3.0 kB Without provenance Details for biro-0.0.3.tar.gz

Release files / biro-0.0.3.tar.gz

Download URL biro-0.0.3.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1eeac323155bec89c3931738a94649e0395484eb2b669dfa92da8e0e0df396c9
BLAKE2b-256 checksum
How to use checksums
6e4af241ae0f505bec440e1ed549cebf499f873620e395138dff6a310c13b6a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for biro 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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