External Files#

class ExternalFileStatusEnum(value)[source]#

Bases: str, Enum

The state of an external file

available = 'available'#
processing = 'processing'#
class ExternalFileTypeEnum(value)[source]#

Bases: str, Enum

The state of an external file

dataset_attachment = 'dataset_attachment'#
class ExternalFile(*, id, file_type, created_on, status, file_name, description, provenance, sha256sum, file_size)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
id: int#
file_type: ExternalFileTypeEnum#
created_on: datetime#
status: ExternalFileStatusEnum#
file_name: str#
description: str | None#
provenance: dict[str, Any]#
sha256sum: str#
file_size: int#
propagate_client(client)[source]#
get_direct_url()[source]#
download(destination_path, overwrite=False)[source]#

Downloads an external file to the given path

The file size and checksum will be checked against the metadata stored on the server

Parameters:
  • destination_path (str) – Full path to the destination file (including filename)

  • overwrite (bool) – If True, allow for overwriting an existing file. If False, and a file already exists at the given destination path, an exception will be raised.

Return type:

None

model_config = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)#

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None