SDK

Drive

One security group's files — the web app's "drive": list, upload, folders, download.

On this page

class

Signature #

class Drive(nodes: _Nodes, security_group_id: str)

One security group's files — the web app's "drive": list, upload, folders, download.

Members #

security_group_id: str #

property

The group this drive belongs to.

list(*, exam_id: str | None = None, parent_id: str | None = None, include_pending: bool = False, limit: int = 50, cursor: str | None = None) -> Page[DriveNode] #

method

One page of this group's nodes, optionally of one exam or one folder.

iter_all(*, exam_id: str | None = None, parent_id: str | None = None, include_pending: bool = False, limit: int = 50) -> Iterator[DriveNode] #

method

Every node of this group, across all pages.

upload(source: str | os.PathLike[str] | bytes | BinaryIO, *, name: str | None = None, mime_type: str | None = None, exam_id: str | None = None, parent_id: str | None = None) -> DriveNode #

method

Uploads one file; `name` defaults to the path's file name, `mime_type` to a guess from it.

upload_many(sources: Iterable[UploadInput], *, exam_id: str | None = None, parent_id: str | None = None) -> list[DriveNode] #

method

Uploads a batch (reserved 100 at a time), optionally linked to an exam or placed in a folder.

create_folder(name: str, *, parent_id: str | None = None) -> str #

method

Creates a folder and returns its node id — pass it as `parent_id` to upload into it. The vault cannot tell two folder names apart (it only sees ciphertext), so calling this twice creates two folders.

get(node_id: str) -> DriveNode #

method

One ready file's index; folders and unfinished uploads answer `NotFoundError`.

name_of(node: DriveNode) -> str #

method

Opens the node's sealed file name.

iter_download(node_id: str) -> Iterator[bytes] #

method

Downloads and decrypts one file lazily, a chunk at a time.

download(node_id: str, destination: str | os.PathLike[str] | BinaryIO | None = None) -> bytes | None #

method

The plaintext bytes, or written to `destination` (a path or a binary file) chunk by chunk.