parseur.document

Classes

DocumentOrderKey

Enumeration of supported document sorting keys.

Document

Document resource providing class-based API access.

Module Contents

class parseur.document.DocumentOrderKey[source]

Bases: str, enum.Enum

Enumeration of supported document sorting keys.

Used with the order_by parameter to specify sorting in list_documents and yield_documents.

Members:

  • NAME: Sort by document name.

  • CREATED: Sort by created/received date.

  • PROCESSED: Sort by processed date.

  • STATUS: Sort by document status.

NAME = 'name'[source]
CREATED = 'created'[source]
PROCESSED = 'processed'[source]
STATUS = 'status'[source]
class parseur.document.Document[source]

Document resource providing class-based API access.

classmethod from_response(data: Dict) Dict[source]

Validate and deserialize a single document dict.

classmethod log_from_response(data: Dict) Dict[source]

Validate and deserialize a single document log dict.

classmethod upload_from_response(data: Dict) Dict[source]

Validate and deserialize a single document log dict.

classmethod iter(mailbox_id: int, *, search: str | None = None, order_by: DocumentOrderKey | None = None, ascending: bool = True, received_after: datetime.datetime | None = None, received_before: datetime.datetime | None = None, with_result: bool = False) Iterable[Dict][source]

Yield all documents in a mailbox with pagination and filtering.

Parameters:
  • mailbox_id – The mailbox ID to retrieve documents from.

  • search (str) –

    Search string to filter documents. The search query parameter searches the following properties:

    • document id (exact match)

    • document name

    • template name

    • from, to, cc, and bcc email addresses

    • document metadata header

  • order_by (DocumentOrderKey) – Enum value specifying the sorting field.

  • ascending (bool) – Whether to sort in ascending order (True) or descending order (False).

  • received_after (datetime.datetime) – Filter for documents received after this date (converted to UTC YYYY-MM-DD).

  • received_before (datetime.datetime) – Filter for documents received before this date (converted to UTC YYYY-MM-DD).

  • with_result (bool) – Whether to include the parsed result in the returned documents.

Yield dict:

Each yielded dictionary represents a document.

classmethod list(mailbox_id: int, *, search: str | None = None, order_by: DocumentOrderKey | None = None, ascending: bool = True, received_after: datetime.datetime | None = None, received_before: datetime.datetime | None = None, with_result: bool = False) List[Dict][source]
classmethod retrieve(document_id: str) Dict[source]

Retrieve document details, deserialized.

classmethod reprocess(document_id: str) Dict[source]
classmethod skip(document_id: str) Dict[source]
classmethod copy(document_id: str, target_mailbox_id: int) Dict[source]
classmethod logs(document_id: str) List[Dict][source]
classmethod delete(document_id: str) bool[source]
classmethod upload_file(mailbox_id: int, file_path: str) Dict[source]
classmethod batch_upload_files(file_paths: List[str], mailbox_id: int) Iterable[Dict][source]
classmethod upload_folder(mailbox_id: int, folder_path: str) Iterable[Dict][source]
classmethod upload_text(recipient: str, subject: str, sender: str | None = None, body_html: str | None = None, body_plain: str | None = None) Dict[source]