parseur.export_config

Classes

ExportConfig

Manage a mailbox's export configurations and download their exports.

Functions

Module Contents

parseur.export_config._export_type_value(value: str | parseur.schemas.export_config.ExportType) str[source]
class parseur.export_config.ExportConfig[source]

Manage a mailbox’s export configurations and download their exports.

An export config selects which columns (items) to export for the mailbox (PARSER) or one of its table fields (PARSER_FIELD). Use available_fields() to discover the columns you can include, and download() to fetch the resulting CSV/XLSX.

classmethod from_response(data: Dict) Dict[source]

Validate/deserialize an export config and resolve its download URLs.

classmethod iter(mailbox_id: int, *, api_key: str | None = None) Iterable[Dict][source]

Yield all export configurations of a mailbox (handles pagination).

classmethod list(mailbox_id: int, *, api_key: str | None = None) List[Dict[str, Any]][source]

Retrieve all export configurations of a mailbox as a list.

classmethod retrieve(mailbox_id: int, export_config_id: int, *, api_key: str | None = None) Dict[str, Any][source]

Retrieve a single export configuration by its ID.

classmethod create(mailbox_id: int, name: str, items: List[str], *, export_type: str | parseur.schemas.export_config.ExportType = ExportType.PARSER.value, parser_field_id: str | None = None, api_key: str | None = None) Dict[str, Any][source]

Create an export configuration.

Parameters:
  • mailbox_id – ID of the mailbox.

  • name – Name of the export configuration.

  • items – Columns to export (see available_fields()).

  • export_typePARSER (document-level) or PARSER_FIELD (a table field). See ExportType.

  • parser_field_id – The table field id, required for PARSER_FIELD exports (e.g. “PF1”).

  • api_key – Optional API key overriding the global one for this call.

Returns:

The created export configuration.

Raises:

marshmallow.ValidationError – If a value is invalid.

classmethod update(mailbox_id: int, export_config_id: int, *, api_key: str | None = None, **fields: Any) Dict[str, Any][source]

Update an export configuration. Only the fields you pass are changed.

Parameters:

fields – Writable fields (name, type, items, parser_field_id).

Raises:

marshmallow.ValidationError – If a value is invalid or an unknown field is provided.

classmethod delete(mailbox_id: int, export_config_id: int, *, api_key: str | None = None) bool[source]

Delete an export configuration. Returns True on success.

classmethod available_fields(mailbox_id: int, *, api_key: str | None = None) List[Dict[str, Any]][source]

List the groups of columns that can be exported for a mailbox.

Returns one entry for the document-level export (PARSER) and one per table field (PARSER_FIELD), each with the items you can pass to create().

classmethod download(mailbox_id: int, export_config_id: int, fmt: str = 'csv', *, api_key: str | None = None) bytes[source]

Download the configured export and return its raw bytes.

Parameters:

fmt"csv" (default) or "xlsx" ("xls" is accepted).

Returns:

The export file content as bytes.