Skip to main content

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 - always False, query is always considered without prefix
  • Strict null handling

Stringifier:

  • custom encoder and decoder functions
  • sorting of keys
  • filtering of keys

Additional support

  • parsing primitive values: int, float are represented as decimal.Decimal, bool-like values are represented as bool whatever the case they are in, however this can be processed strictly using primitive_strict option, null-like values are represented as None

Modifications:

Parser:

  • sparse arrays are represented as dictionaries with keys as indexes
  • undefined 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


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.6.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

qstion-1.1.6-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file qstion-1.1.6.tar.gz.

File metadata

  • Download URL: qstion-1.1.6.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.5

File hashes

Hashes for qstion-1.1.6.tar.gz
Algorithm Hash digest
SHA256 a86079b7fd137365d16f265ced906d30702dea670bf03707f5ad7b7a3ecd9046
MD5 cd27c6d50320a09a41b2d51482a17349
BLAKE2b-256 0d4a39a9c21eb452706909110152747f947fc5319f9899ec5d96fe8602bf22e4

See more details on using hashes here.

File details

Details for the file qstion-1.1.6-py3-none-any.whl.

File metadata

  • Download URL: qstion-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.5

File hashes

Hashes for qstion-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c2b3d70cf3eea3c19a7821e364ee30dab61dd47d0bf586b20d7c13ef3e8db145
MD5 c996955efd57e7b12d6e420c53588c48
BLAKE2b-256 2bcd0a46952d1a6c1661da1638d77e0b95a5fefdc04b58dee35e0235291390a3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page