Simple package for parsing querystrings into nested dictionaries and vice versa.
Project description
qstion
A querystring parsing and stringifying library with some added security. Library was based on this js library.
Usage
import qstion as qs
x = qs.parse('a=c')
assert x == {'a': 'c'}
x_str = qs.stringify(x)
assert x_str == 'a=c'
Documentation details
Full documentation reference: https://www.npmjs.com/package/qs Result of parsing can be returned as root object if needed, but default implementation is to return a dictionary.
Not supported
Parser:
plainObjects
ignoreQueryPrefix
- alwaysFalse
, query is always considered without prefixStrict null handling
Stringifier:
- custom
encoder
anddecoder
functions sorting
of keysfiltering
of keys
Additional support
- parsing
primitive
values:int
,float
are represented asdecimal.Decimal
, bool-like values are represented asbool
whatever the case they are in, however this can be processed strictly usingprimitive_strict
option, null-like values are represented asNone
Modifications:
Parser:
sparse arrays
are represented as dictionaries with keys as indexesundefined
values are represented as strings'undefined'
- queries such as
a
without=
are considered as non-value and thus are not included in the result
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
qstion-1.1.1.tar.gz
(18.7 kB
view details)
Built Distribution
qstion-1.1.1-py3-none-any.whl
(15.3 kB
view details)
File details
Details for the file qstion-1.1.1.tar.gz
.
File metadata
- Download URL: qstion-1.1.1.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3aa06905683782a365fe3c182d66f0f3ca8116887d9a3ec0c6fdc50e5619fcd5 |
|
MD5 | 249e436205e7be3826752c2cf54de7a6 |
|
BLAKE2b-256 | 6bced25bf75da12d86f8fb6d334188d16c5098c96132e0b107f69035a2844ed4 |
File details
Details for the file qstion-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: qstion-1.1.1-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7b61b0b14049fce4ff0a7704d73e573a864222c3ccc671dacee72e9ec9a98e1 |
|
MD5 | 387948d600ce71c1d58231ec290efd8e |
|
BLAKE2b-256 | 6b0a2d538da7dfe845a6927290df7a927568811364ed24c0f3d86906563a86e5 |