A faster URL dispatcher for aiohttp
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
aiohttp-fast-url-dispatcher
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiohttp_fast_url_dispatcher-0.3.1.tar.gz.
File metadata
- Download URL: aiohttp_fast_url_dispatcher-0.3.1.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a730a3872503ee5c94c65c6dee2a17b4773e022630f2557cae84f2e74ea26ed
|
|
| MD5 |
b5827ee2719639f9c93b047d368a30e9
|
|
| BLAKE2b-256 |
0f4a9be8071f66a46f28d599915832ed9a19b0004f2967d3a5398f0a4f29ec82
|
File details
Details for the file aiohttp_fast_url_dispatcher-0.3.1-py3-none-any.whl.
File metadata
- Download URL: aiohttp_fast_url_dispatcher-0.3.1-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f7c0040f466e599e34e5b996ae897d13463ddf34b82d15c9048e8d6c6e00412
|
|
| MD5 |
ac6e380a31e4eb844ce32e587ff80196
|
|
| BLAKE2b-256 |
92ad2763e6c3334e2e53bd210acec81f41499942327d6de17f1faeb221fbcee9
|