Skip to content

ZIP Import

Accessed via client.zip.

pycomad.client.ZipClient

ZipClient(http: _HttpSession)

Methods for the /zip/upload batch-import endpoint.

upload

upload(file: FileArg, *, creator: Optional[str] = None) -> ZipUploadResult

Batch-import a ZIP archive.

Creates a category tree that mirrors the archive's directory structure (root category named <stem>-<YYYYMMDD-HHMMSS>), then uploads every file as an asset linked to its directory's category.

macOS artifacts (__MACOSX/, .DS_Store, ._*) are silently skipped. The ZIP file itself is never stored as an asset.

Requires a Professional subscription or higher on the server.

Parameters:

Name Type Description Default
file FileArg

ZIP file to import — a path string, :class:~pathlib.Path, or an open binary file object.

required
creator Optional[str]

Author / creator name applied to all extracted assets.

None

Returns:

Type Description
ZipUploadResult

class:~pycomad.models.ZipUploadResult describing all categories

ZipUploadResult

and assets created, plus any per-entry errors.

Raises:

Type Description
ComadAuthError

If not authenticated or the user lacks Professional access (403).

ComadValidationError

On a 400 response.