Note: You are looking at a static snapshot of documentation related to Robot Framework automations. The most recent documentation is at https://robocorp.com/docs

RPA.Robocorp.Storage

Delete an asset by providing its name.

Arguments

ArgumentTypeDefault value
namestrnull

This operation cannot be undone.

param name:Name of the asset to delete
raises AssetNotFound:Asset with the given name does not exist

Example: Robot Framework

*** Tasks *** Remove An Asset Delete Asset my-asset

Example: Python

def remove_an_asset(): storage.delete_asset("my-asset")

Get the asset's bytes value by providing its name.

Arguments

ArgumentTypeDefault value
namestrnull
param name:Name of the asset
raises AssetNotFound:Asset with the given name does not exist
returns:The current value of this asset as bytes

Example: Robot Framework

*** Tasks *** Retrieve An Asset ${value} = Get Bytes Asset my-bytes-asset Log Asset bytes value: ${value}

Example: Python

def retrieve_an_asset(): value = storage.get_bytes_asset("my-bytes-asset") print(b"Asset bytes value:", value)

Get the asset's content saved to disk by providing its name.

Arguments

ArgumentTypeDefault value
namestrnull
pathstrnull
overwriteboolFalse
param name:Name of the asset
param path:Destination path to the downloaded file
param overwrite:Replace destination file if it already exists (default False)
raises AssetNotFound:Asset with the given name does not exist
returns:A local path pointing to the retrieved file

Example: Robot Framework

*** Tasks *** Retrieve An Asset ${path} = Get File Asset my-file-asset report.pdf Log Asset file path: ${path}

Example: Python

def retrieve_an_asset(): path = storage.get_file_asset("my-file-asset", "report.pdf") print("Asset file path:", path)

Get the asset's dictionary value by providing its name.

Arguments

ArgumentTypeDefault value
namestrnull
param name:Name of the asset
raises AssetNotFound:Asset with the given name does not exist
returns:The current value of this asset as a dictionary

Example: Robot Framework

*** Tasks *** Retrieve An Asset &{value} = Get JSON Asset my-json-asset Log Asset dictionary value: ${value}

Example: Python

def retrieve_an_asset(): value = storage.get_json_asset("my-json-asset") print("Asset dictionary value:", value)

Get the asset's text value by providing its name.

Arguments

ArgumentTypeDefault value
namestrnull
param name:Name of the asset
raises AssetNotFound:Asset with the given name does not exist
returns:The current value of this asset as text

Example: Robot Framework

*** Tasks *** Retrieve An Asset ${value} = Get Text Asset my-text-asset Log Asset text value: ${value}

Example: Python

def retrieve_an_asset(): value = storage.get_text_asset("my-text-asset") print("Asset text value:", value)

List all the existing assets.

returns:A list of available assets' names

Example: Robot Framework

*** Tasks *** Print All Assets @{assets} = List Assets Log List ${assets}

Example: Python

def print_all_assets(): print(storage.list_assets())

Creates or updates an asset named name with the provided bytes value.

Arguments

ArgumentTypeDefault value
namestrnull
valuebytesnull
waitboolTrue
param name:Name of the existing or new asset to create (if missing)
param value:The new bytes value to set within the asset
param wait:Wait for the value to be set successfully

Example: Robot Framework

*** Tasks *** Set An Asset ${random_bytes} = Evaluate os.urandom(10) modules=os Set Bytes Asset my-bytes-asset ${random_bytes}

Example: Python

import os def set_an_asset(): random_bytes = os.urandom(10) storage.set_bytes_asset("my-bytes-asset", random_bytes)

Creates or updates an asset named name with the content of the given path file.

Arguments

ArgumentTypeDefault value
namestrnull
pathstrnull
waitboolTrue
param name:Name of the existing or new asset to create (if missing)
param path:The file path whose content to be set within the asset
param wait:Wait for the value to be set successfully

Example: Robot Framework

*** Tasks *** Set An Asset Set File Asset my-file-asset report.pdf

Example: Python

def set_an_asset(): storage.set_file_asset("my-file-asset", "report.pdf")

Creates or updates an asset named name with the provided dictionary value.

Arguments

ArgumentTypeDefault value
namestrnull
valueDictnull
waitboolTrue
param name:Name of the existing or new asset to create (if missing)
param value:The new dictionary value to set within the asset
param wait:Wait for the value to be set successfully

Example: Robot Framework

*** Tasks *** Set An Asset &{entries} = Create Dictionary dogs ${10} Set JSON Asset my-json-asset ${entries}

Example: Python

def set_an_asset(): entries = {"dogs": 10} storage.set_json_asset("my-json-asset", entries)

Creates or updates an asset named name with the provided text value.

Arguments

ArgumentTypeDefault value
namestrnull
valuestrnull
waitboolTrue
param name:Name of the existing or new asset to create (if missing)
param value:The new text value to set within the asset
param wait:Wait for the value to be set successfully

Example: Robot Framework

*** Tasks *** Set An Asset Set Text Asset my-text-asset My asset value as text

Example: Python

def set_an_asset(): storage.set_text_asset("my-text-asset", "My asset value as text")