Falcon-deps
Dependency injector for Falcon Framework based on taskiq-dependencies.
Installation
Install with pip
pip install falcon-deps
Install with poetry
poetry add falcon-deps
Usage
Start Usage
It's simple as possible.
from falcon_deps import InjectableResource
from falcon.asgi import App, Request, Response
from taskiq_dependencies import Depends
# Imagine we have a database pool.
async def db_pool(
# Retrieve request object from the actual request.
request: Request = Depends(),
) -> ConnectionPool:
return request.context._pool
class Resource(InjectableResource):
async def on_get(
self,
request: Request,
response: Response,
# Retrieve database pool as a dependency
db_pool: ConnctionPool = Depends(db_pool)
) -> None:
...
app = App()
app.add_route(
"/test",
Resource(),
)
Advanced Usage
Falcon gives option to specify suffix for resource.
If you want to use suffix with InjectableResource you need to pass suffix to InjectableResource too.
app.add_route(
"/test",
Resource(suffix="bob",),
suffix="bob",
)
If some of methods in Resource don't need dependency injection, it's possible to remove them from injection with exclude_responder_from_inject.
app.add_route(
"/test",
Resource(
exclude_responder_from_inject={
# Remove on_get and on_post methods from injection.
"on_get",
"on_post",
},
),
)
Metadata
Release files for falcon-deps 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| falcon_deps-0.1.3.tar.gz | 4.1 kB | Without provenance | Details for falcon_deps-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| falcon_deps-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for falcon_deps-0.1.3-py3-none-any.whl |
Total release size: 7.9 kB
Release files / falcon_deps-0.1.3.tar.gz
| Download URL | falcon_deps-0.1.3.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a258bba6d1ec3c19e941f7361e54e5d6cd49ef85387d388beaad94e7f87a3647
|
|
BLAKE2b-256 checksum How to use checksums |
2aca8d828d4f4d45db3009db8229af6b7977dace8d6627b1d3017583b4f3114f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.9.20 Linux/6.5.0-1025-azure
|
Release files / falcon_deps-0.1.3-py3-none-any.whl
| Download URL | falcon_deps-0.1.3-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13af56f6c5d30b4aee068e38621cfa76a313b0e50a7e2025e425034ac68b1164
|
|
BLAKE2b-256 checksum How to use checksums |
f87a530f873fc597a7eeb83d6943eb9a5c89b749f0e9ff85e87569a3bac3f541
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.9.20 Linux/6.5.0-1025-azure
|
Security for falcon-deps 0.1.3
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.