{"id":28764936,"url":"https://github.com/klen/http-router","last_synced_at":"2025-08-24T13:39:29.878Z","repository":{"id":52674654,"uuid":"311687151","full_name":"klen/http-router","owner":"klen","description":"A simple router for HTTP applications","archived":false,"fork":false,"pushed_at":"2024-11-05T13:51:30.000Z","size":273,"stargazers_count":27,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-08-10T08:48:22.803Z","etag":null,"topics":["http-router"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/klen.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-11-10T14:39:51.000Z","updated_at":"2025-07-03T13:53:15.000Z","dependencies_parsed_at":"2024-06-18T15:29:21.151Z","dependency_job_id":"3c3eef69-e5a6-4c37-8401-7c76ac17839b","html_url":"https://github.com/klen/http-router","commit_stats":null,"previous_names":[],"tags_count":96,"template":false,"template_full_name":null,"purl":"pkg:github/klen/http-router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klen%2Fhttp-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klen%2Fhttp-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klen%2Fhttp-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klen%2Fhttp-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klen","download_url":"https://codeload.github.com/klen/http-router/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klen%2Fhttp-router/sbom","scorecard":{"id":563325,"data":{"date":"2025-08-11","repo":{"name":"github.com/klen/http-router","commit":"033271b20bbbec1ca1ee3a31eaabd282d18459b8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/tests.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:63: update your workflow using https://app.stepsecurity.io/secureworkflow/klen/http-router/release.yml/develop?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:69: update your workflow using https://app.stepsecurity.io/secureworkflow/klen/http-router/release.yml/develop?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:73: update your workflow using https://app.stepsecurity.io/secureworkflow/klen/http-router/release.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:79: update your workflow using https://app.stepsecurity.io/secureworkflow/klen/http-router/release.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:90: update your workflow using https://app.stepsecurity.io/secureworkflow/klen/http-router/release.yml/develop?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:96: update your workflow using https://app.stepsecurity.io/secureworkflow/klen/http-router/release.yml/develop?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:107: update your workflow using https://app.stepsecurity.io/secureworkflow/klen/http-router/release.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/klen/http-router/release.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/klen/http-router/release.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/klen/http-router/tests.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/klen/http-router/tests.yml/develop?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/klen/http-router/tests.yml/develop?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/release.yml:21","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:35","Info:   0 out of   7 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/release.yml:84"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'develop'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}}]},"last_synced_at":"2025-08-20T14:16:30.960Z","repository_id":52674654,"created_at":"2025-08-20T14:16:30.960Z","updated_at":"2025-08-20T14:16:30.960Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271876373,"owners_count":24837383,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http-router"],"created_at":"2025-06-17T10:13:01.842Z","updated_at":"2025-08-24T13:39:29.828Z","avatar_url":"https://github.com/klen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"HTTP Router\n###########\n\n.. _description:\n\n**http-router** -- A simple router for HTTP applications\n\nThe library is not a HTTP framework. It's an utilite to build the frameworks.\nThe main goal of the library to bind targets to http routes and match them.\n\n.. _badges:\n\n.. image:: https://github.com/klen/http-router/workflows/tests/badge.svg\n    :target: https://github.com/klen/http-router/actions\n    :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/http-router\n    :target: https://pypi.org/project/http-router/\n    :alt: PYPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/http-router\n    :target: https://pypi.org/project/http-router/\n    :alt: Python Versions\n\n.. _contents:\n\n.. contents::\n\n\n.. _requirements:\n\nRequirements\n=============\n\n- python 3.9, 3.10, 3.11, 3.12, 3.13, pypy3\n\n\n.. _installation:\n\nInstallation\n=============\n\n**http-router** should be installed using pip: ::\n\n    pip install http-router\n\n\nUsage\n=====\n\nCreate a router:\n\n.. code:: python\n\n    from http_router import Router\n\n\n    # Initialize the router\n    router = Router(trim_last_slash=True)\n\n\nDefine routes:\n\n.. code:: python\n\n    @router.route('/simple')\n    def simple():\n        return 'result from the fn'\n\nCall the router with HTTP path and optionally method to get a match result.\n\n.. code:: python\n\n   match = router('/simple', method='GET')\n   assert match, 'HTTP path is ok'\n   assert match.target is simple\n\nThe router supports regex objects too:\n\n.. code:: python\n\n    import re\n\n    @router.route(re.compile(r'/regexp/\\w{3}-\\d{2}/?'))\n    def regex():\n        return 'result from the fn'\n\nBut the lib has a simplier interface for the dynamic routes:\n\n.. code:: python\n\n    @router.route('/users/{username}')\n    def users():\n        return 'result from the fn'\n\nBy default this will capture characters up to the end of the path or the next\n``/``.\n\nOptionally, you can use a converter to specify the type of the argument like\n``{variable_name:converter}``.\n\nConverter types:\n\n========= ====================================\n``str``   (default) accepts any text without a slash\n``int``   accepts positive integers\n``float`` accepts positive floating point values\n``path``  like string but also accepts slashes\n``uuid``  accepts UUID strings\n========= ====================================\n\nConvertors are used by prefixing them with a colon, like so:\n\n.. code:: python\n\n    @router.route('/orders/{order_id:int}')\n    def orders():\n        return 'result from the fn'\n\nAny unknown convertor will be parsed as a regex:\n\n.. code:: python\n\n    @router.route('/orders/{order_id:\\d{3}}')\n    def orders():\n        return 'result from the fn'\n\n\nMultiple paths are supported as well:\n\n.. code:: python\n\n    @router.route('/', '/home')\n    def index():\n        return 'index'\n\n\nHandling HTTP methods:\n\n.. code:: python\n\n    @router.route('/only-post', methods=['POST'])\n    def only_post():\n        return 'only-post'\n\n\nSubmounting routes:\n\n.. code:: python\n\n   subrouter = Router()\n\n   @subrouter.route('/items/{item}')\n   def items():\n        pass\n\n    router = Router()\n    router.route('/api')(subrouter)\n\n\n   match = router('/api/items/12', method='GET')\n   assert match, 'HTTP path is ok'\n   assert match.target is items\n    assert match.params == {\"item\": \"12\"}\n\n\n.. _bugtracker:\n\nBug tracker\n===========\n\nIf you have any suggestions, bug reports or\nannoyances please report them to the issue tracker\nat https://github.com/klen/http-router/issues\n\n\n.. _contributing:\n\nContributing\n============\n\nDevelopment of the project happens at: https://github.com/klen/http-router\n\n\n.. _license:\n\nLicense\n========\n\nLicensed under a `MIT license`_.\n\n\n.. _links:\n\n.. _klen: https://github.com/klen\n.. _MIT license: http://opensource.org/licenses/MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklen%2Fhttp-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklen%2Fhttp-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklen%2Fhttp-router/lists"}