No project description provided
Project description
Fast Params
Support Rails style QueryParams and FormData for Starlette and FastAPI.
you can also used it in other frameworks, if your params or forms follow this protocol.
@runtime_checkable
class MultiDict(Protocol):
def multi_items(self) -> list[tuple[str, Any]]: ...
Install
pip install fast-params
Usage
from fast_params import ParamParser
from starlette.datastructures import MultiDict
def test_parse_simple():
parser = ParamParser()
params = MultiDict({
"a": 1,
"b": 2
})
expect = {
"a": 1,
"b": 2
}
assert parser(params) == expect
def test_array():
parser = ParamParser()
params = MultiDict([
("a", 1),
("b[]", 2),
("c[d]", 3),
("c[f]", 4),
("f[d][]", 5),
("f[d][]", 6),
])
expect = {
"a": 1,
"b": [2],
"c": {
"d": 3,
"f": 4
},
"f": {
"d": [5, 6]
}
}
assert parser(params) == expect
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fast_params-0.1.1.tar.gz
(2.2 kB
view details)
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 fast_params-0.1.1.tar.gz.
File metadata
- Download URL: fast_params-0.1.1.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/23.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9842424abf76784f9378f57d83c68ff8f363fa97d37c920a9703e499b9e2ce94
|
|
| MD5 |
a1e051b2a9d6cfdf788a52f6ba217c6f
|
|
| BLAKE2b-256 |
13af1c148bd3632e9617253314c54f367befee393928f945d44c99b08f7ef8b7
|
File details
Details for the file fast_params-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fast_params-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/23.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59c43a23a84cccca60b3ac470ce6113212fdcf50f46fd907eda61d1c0add5ab5
|
|
| MD5 |
b71d1d7a963f99fc8940d70b3b357b02
|
|
| BLAKE2b-256 |
31f20d971be54f12a2bcdb43593f94ab0f27d208ea0ad210b9b3b7ea2238e87a
|