Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aiohttp-fast-url-dispatcher

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aiohttp-fast-url-dispatcher

A faster URL dispatcher for aiohttp

  • 0.3.1
  • PyPI
  • Socket score

Maintainers
1

aiohttp-fast-url-dispatcher

CI Status Documentation Status Test coverage percentage

Poetry black pre-commit

PyPI Version Supported Python versions License


Documentation: https://aiohttp-fast-url-dispatcher.readthedocs.io

Source Code: https://github.com/bdraco/aiohttp-fast-url-dispatcher


A faster URL dispatcher for aiohttp

The default UrlDispatcher implementation does a linear search every which can have a significant TimeComplexity when dispatching urls when there are a lot of routes. FastUrlDispatcher keeps an index of the urls which allows for fast dispatch.

This library will become obsolete with aiohttp 3.10 as the changes are expected to merge upstream via https://github.com/aio-libs/aiohttp/pull/7829

Installation

Install this via pip (or your favourite package manager):

pip install aiohttp-fast-url-dispatcher

Usage

Attach to a web.Application before any resources are registered.

dispatcher = FastUrlDispatcher()
app = web.Application()
attach_fast_url_dispatcher(app, dispatcher)

Create with a new web.Application

dispatcher = FastUrlDispatcher()
app = web.Application(router=dispatcher)

Caveats

If you have multiple handlers that resolve to the same URL, this module will always prefer the static name over a dynamic name. For example:

app.router.add_get(r"/second/{user}/info", handler)
app.router.add_get("/second/bob/info", handler)

"/second/bob/info" will always be matched before r"/second/{user}/info"

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

This package was created with Copier and the browniebroke/pypackage-template project template.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc