qs_codec.enums package

Submodules

qs_codec.enums.charset module

Charset enum module.

class qs_codec.enums.charset.Charset(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: _CharsetDataMixin, Enum

Character set.

LATIN1 = _CharsetDataMixin(encoding='iso-8859-1')

ISO-8859-1 (Latin-1) character encoding.

UTF8 = _CharsetDataMixin(encoding='utf-8')

UTF-8 character encoding.

qs_codec.enums.duplicates module

This module contains an enum of all available duplicate key handling strategies.

class qs_codec.enums.duplicates.Duplicates(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

An enum of all available duplicate key handling strategies.

COMBINE = 1

Combine duplicate keys into a single key with an array of values.

FIRST = 2

Use the first value for duplicate keys.

LAST = 3

Use the last value for duplicate keys.

qs_codec.enums.format module

An enum of all supported URI component encoding formats.

class qs_codec.enums.format.Format(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: _FormatDataMixin, Enum

An enum of all supported URI component encoding formats.

RFC1738 = _FormatDataMixin(format_name='RFC1738', formatter=<function Formatter.rfc1738>)

RFC 1738.

RFC3986 = _FormatDataMixin(format_name='RFC3986', formatter=<function Formatter.rfc3986>)

RFC 3986.

class qs_codec.enums.format.Formatter[source]

Bases: object

A class for formatting URI components.

static rfc1738(value: str) str[source]

Format a string according to RFC 1738.

static rfc3986(value: str) str[source]

Format a string according to RFC 3986.

qs_codec.enums.list_format module

An enum for all available list format options.

class qs_codec.enums.list_format.ListFormat(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: _ListFormatDataMixin, Enum

An enum of all available list format options.

BRACKETS = _ListFormatDataMixin(list_format_name='BRACKETS', generator=<function ListFormatGenerator.brackets>)

Use brackets to represent list items, for example foo[]=123&foo[]=456&foo[]=789

COMMA = _ListFormatDataMixin(list_format_name='COMMA', generator=<function ListFormatGenerator.comma>)

Use commas to represent list items, for example foo=123,456,789

INDICES = _ListFormatDataMixin(list_format_name='INDICES', generator=<function ListFormatGenerator.indices>)

Use indices to represent list items, for example foo[0]=123&foo[1]=456&foo[2]=789

REPEAT = _ListFormatDataMixin(list_format_name='REPEAT', generator=<function ListFormatGenerator.repeat>)

Use a repeat key to represent list items, for example foo=123&foo=456&foo=789

class qs_codec.enums.list_format.ListFormatGenerator[source]

Bases: object

A class for formatting list items.

static brackets(prefix: str, key: str | None = None) str[source]

Format a list item using brackets.

static comma(prefix: str, key: str | None = None) str[source]

Format a list item using commas.

static indices(prefix: str, key: str | None = None) str[source]

Format a list item using indices.

static repeat(prefix: str, key: str | None = None) str[source]

Format a list item using repeats.

qs_codec.enums.sentinel module

This module defines the Sentinel enum, which contains all available sentinel values.

class qs_codec.enums.sentinel.Sentinel(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: _SentinelDataMixin, Enum

An enum of all available sentinel values.

CHARSET = _SentinelDataMixin(raw='✓', encoded='utf8=%E2%9C%93')

These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.

ISO = _SentinelDataMixin(raw='&#10003;', encoded='utf8=%26%2310003%3B')

This is what browsers will submit when the character occurs in an application/x-www-form-urlencoded body and the encoding of the page containing the form is iso-8859-1, or when the submitted form has an accept-charset attribute of iso-8859-1. Presumably also with other charsets that do not contain the character, such as us-ascii.

Module contents