Attachments
Attachments are non-data files stored in an experiment.
Properties
Properties are getter and setter methods representing the underlying CellEngine object. Properties are the snake_case equivalent of those documented in the CellEngine API unless otherwise noted.
Methods
cellengine.resources.attachment.Attachment
A class representing a CellEngine attachment. Attachments are non-data files that are stored in an experiment.
crc32c: str
property
created: datetime
property
experiment_id: str
property
filename: str
property
writable
id: str
property
Alias for _id
.
md5: str
property
size: int
property
delete()
download(to_file=None)
Download the attachment.
Defaults to returning the file as a blob. If to_file
is specified,
the file will be saved to disk.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to_file
|
str
|
Path at which to save the file. Accepts relative or absolute paths. |
None
|
Returns:
Name | Type | Description |
---|---|---|
content |
Optional[bytes]
|
The raw response content. |
get(experiment_id, _id=None, name=None)
classmethod
Get an Attachment by name or ID for a specific experiment. Either
name
or _id
must be specified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_id
|
str
|
ID of the experiment this attachment is connected with. |
required |
_id
|
optional
|
ID of the attachment. |
None
|
name
|
optional
|
Name of the attachment. |
None
|
update()
Save changes to this Attachment to CellEngine.
upload(experiment_id, filepath, filename=None)
staticmethod
Upload an attachment
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filepath
|
str
|
Local path to file to upload. |
required |
filename
|
str
|
Optionally, specify a new name for the file. |
None
|
Returns:
Type | Description |
---|---|
Attachment
|
The newly uploaded Attachment. |