Skip to main content

Tiny HTTP router

Project description


PyPI PyPI - Python Version Code style: black license

Tiny HTTP router.


from tiny_router import SimpleRouter

router = SimpleRouter()

def get_user(params):
    if params.get("user_id") == 1:
        return {"id": 1, "name": "Alice"}

route = router.resolve("GET", "/users/{user_id}")
user = route({"user_id": 1})

assert user == {"id": 1, "name": "Alice"}

More examples are in examples/ directory of repository.


  • SimpleRouter: exact-match router
  • SimpleRegexRouter: simple regex-based router
  • Abstract Router: user can implement their own routers
  • Support for type hints


Module tiny_router


Project details

Download files

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

Source Distribution

tiny-router-0.0.8.tar.gz (4.6 kB view hashes)

Uploaded source

Built Distribution

tiny_router-0.0.8-py3-none-any.whl (6.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page