Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

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.

Release files for aiohttp-fast-url-dispatcher 0.3.1

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

Source distribution (sdist)

Source distribution for aiohttp-fast-url-dispatcher 0.3.1
File Size Uploaded
aiohttp_fast_url_dispatcher-0.3.1.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiohttp-fast-url-dispatcher 0.3.1
File Interpreter ABI Platform
aiohttp_fast_url_dispatcher-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.0 kB

Release files / aiohttp_fast_url_dispatcher-0.3.1.tar.gz

Download URL aiohttp_fast_url_dispatcher-0.3.1.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5a730a3872503ee5c94c65c6dee2a17b4773e022630f2557cae84f2e74ea26ed
BLAKE2b-256 checksum
How to use checksums
0f4a9be8071f66a46f28d599915832ed9a19b0004f2967d3a5398f0a4f29ec82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / aiohttp_fast_url_dispatcher-0.3.1-py3-none-any.whl

Download URL aiohttp_fast_url_dispatcher-0.3.1-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f7c0040f466e599e34e5b996ae897d13463ddf34b82d15c9048e8d6c6e00412
BLAKE2b-256 checksum
How to use checksums
92ad2763e6c3334e2e53bd210acec81f41499942327d6de17f1faeb221fbcee9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

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