Skip to main content
Version: Next

ExportDataKwargs

Keyword arguments accepted by BasicCrawler.export_data.

Combines all ExportDataJsonKwargs and ExportDataCsvKwargs fields, since the export format is determined dynamically from the file extension at call time. Only the kwargs relevant to the selected format are forwarded to the underlying exporter.

Hierarchy

Index

Properties

keyword-onlyoptionalallow_nan

allow_nan: NotRequired[bool]

If False (default: True), raises a ValueError for out-of-range float values (nan, inf, -inf) to strictly comply with the JSON specification. If True, uses their JavaScript equivalents (NaN, Infinity, -Infinity).

keyword-onlyoptionalcheck_circular

check_circular: NotRequired[bool]

If False (default: True), skips the circular reference check for container types. A circular reference will result in a RecursionError or worse if unchecked.

keyword-onlyoptionalcls

cls: NotRequired[type[json.JSONEncoder]]

Allows specifying a custom JSON encoder.

keyword-onlyoptionaldefault

default: NotRequired[Callable]

A function called for objects that can't be serialized otherwise. It should return a JSON-encodable version of the object or raise a TypeError.

keyword-onlyoptionaldelimiter

delimiter: NotRequired[str]

A one-character string used to separate fields. Defaults to ','.

keyword-onlyoptionaldialect

dialect: NotRequired[str]

Specifies a dialect to be used in CSV parsing and writing.

keyword-onlyoptionaldoublequote

doublequote: NotRequired[bool]

Controls how instances of quotechar inside a field should be quoted. When True, the character is doubled; when False, the escapechar is used as a prefix. Defaults to True.

keyword-onlyoptionalensure_ascii

ensure_ascii: NotRequired[bool]

Determines if non-ASCII characters should be escaped in the output JSON string.

keyword-onlyoptionalescapechar

escapechar: NotRequired[str]

A one-character string used to escape the delimiter if quoting is set to QUOTE_NONE and the quotechar if doublequote is False. Defaults to None, disabling escaping.

keyword-onlyoptionalindent

indent: NotRequired[int]

Specifies the number of spaces for indentation in the pretty-printed JSON output.

keyword-onlyoptionallineterminator

lineterminator: NotRequired[str]

The string used to terminate lines produced by the writer. Defaults to '\r\n'.

keyword-onlyoptionalquotechar

quotechar: NotRequired[str]

A one-character string used to quote fields containing special characters, like the delimiter or quotechar, or fields containing new-line characters. Defaults to '"'.

keyword-onlyoptionalquoting

quoting: NotRequired[Literal[0, 1, 2, 3]]

Controls when quotes should be generated by the writer and recognized by the reader. Can take any of the QUOTE_* constants, with a default of QUOTE_MINIMAL.

keyword-onlyoptionalseparators

separators: NotRequired[tuple[str, str]]

A tuple of (item_separator, key_separator). The default is (', ', ': ') if indent is None and (',', ': ') otherwise.

keyword-onlyoptionalskipinitialspace

skipinitialspace: NotRequired[bool]

When True, spaces immediately following the delimiter are ignored. Defaults to False.

keyword-onlyoptionalskipkeys

skipkeys: NotRequired[bool]

If True (default: False), dict keys that are not of a basic type (str, int, float, bool, None) will be skipped instead of raising a TypeError.

keyword-onlyoptionalsort_keys

sort_keys: NotRequired[bool]

Specifies whether the output JSON object should have keys sorted alphabetically.

keyword-onlyoptionalstrict

strict: NotRequired[bool]

When True, raises an exception on bad CSV input. Defaults to False.