robocorp-storage
module robocorp.storage
Functions
list_assets
List all the existing assets.
Returns: A list of available assets' names
delete_asset
Delete an asset by providing its name
.
This operation cannot be undone.
Args:
name
: Asset to delete
Raises:
AssetNotFound
: Asset with the given name does not exist
get_text
Return the given asset as text.
Arguments:
name
: Name of asset
Returns: Asset content as text
Raises:
AssetNotFound
: No asset defined with given name
get_json
Return the given asset as a deserialized JSON object.
Arguments:
name
: Name of asset**kwargs
: Additional parameters forjson.loads
Returns: Asset content as a Python object (dict, list etc.)
Raises:
AssetNotFound
: No asset defined with given nameJSONDecodeError
: Asset was not valid JSON
get_file
Fetch the given asset and store it in a file.
Arguments:
name
: Name of assetpath
: Destination path for downloaded fileexist_ok
: Overwrite file if it already exists
Returns: Path to created file
Raises:
AssetNotFound
: No asset defined with given nameFileExistsError
: Destination already exists
get_bytes
Return the given asset as bytes.
Arguments:
name
: Name of asset
Returns: Asset content as bytes
Raises:
AssetNotFound
: No asset defined with given name
set_text
Create or update an asset to contain the given string.
Arguments:
name
: Name of assettext
: Text content for assetwait
: Wait for asset to update
set_json
Create or update an asset to contain the given object, serialized as JSON.
Arguments:
name
: Name of assetvalue
: Value for asset, e.g. dict or listwait
: Wait for asset to update**kwargs
: Additional arguments forjson.dumps
set_file
Create or update an asset to contain the contents of the given file.
Arguments:
name
: Name of assetpath
: Path to filecontent_type
: Content type (or mimetype) of file, detected automatically from file extension if not definedwait
: Wait for asset to update
set_bytes
Create or update an asset to contain the given bytes.
Arguments:
name
: Name of assetdata
: Raw contentcontent_type
: Content type (or mimetype) of assetwait
: Wait for asset to update
Exceptions
AssetNotFound
No asset with given name/id found.
AssetUploadFailed
There was an unexpected error while uploading an asset.