Skip to main content

tiny-router

PyPI PyPI - Python Version Code style: black license

Tiny HTTP router.

Usage

from tiny_router import SimpleRouter

router = SimpleRouter()


@router.get("/users/{user_id}")
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.

Features

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

API

Module tiny_router

TODO

Metadata

Release files for tiny-router 0.0.8

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

Source distribution (sdist)

Source distribution for tiny-router 0.0.8
File Size Uploaded Provenance Actions
tiny-router-0.0.8.tar.gz 4.6 kB Without provenance Details for tiny-router-0.0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tiny-router 0.0.8
File Interpreter ABI Platform Actions
tiny_router-0.0.8-py3-none-any.whl Python 3 none any Details for tiny_router-0.0.8-py3-none-any.whl

Total release size: 11.1 kB

Release files / tiny-router-0.0.8.tar.gz

Download URL tiny-router-0.0.8.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d9daa09fc62186b2aefc995e2bf39d342457fc0e679a987e56f40f39749d05b4
BLAKE2b-256 checksum
How to use checksums
5f1a9b7e4e06202c4fb22a93405c13ab52197c9981fdbe3d426fc0e4e272ef67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/2.7.12 Darwin/20.2.0

Release files / tiny_router-0.0.8-py3-none-any.whl

Download URL tiny_router-0.0.8-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7db11f3688bba0d032d6754806f52585102765ed7844c6f0b8196c2e94f1da5f
BLAKE2b-256 checksum
How to use checksums
480bb10f704d4ab1241f1a36135147453dad104d3244cfcf44634cb5c3f9e774
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/2.7.12 Darwin/20.2.0

Security for tiny-router 0.0.8

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