No project description provided
Project description
Fast Params
Support Rails style QueryParams and FormData for Starlette and FastAPI
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.0.tar.gz
(2.1 kB
view hashes)
Built Distribution
Close
Hashes for fast_params-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95913179684a405edfa206cfe478c85eeb0dc1157da877191c2866665e614c6a |
|
MD5 | 080c875df3518d3b07167432e41fa494 |
|
BLAKE2b-256 | d869b1bbb73e124c28530f2f2227f89f9e143d3fdecc02a9ead5ed813cc4a539 |