# API Reference v10.3.1 (Python)

## AxisStorage (class)

Module: zaber_motion.ascii

Class providing access to axis storage.

Requires at least Firmware 7.30.

The following example illustrates how you can obtain an instance of this type:

```py
from zaber_motion.ascii import Connection

connection = Connection.open_serial_port("COM3")
device = connection.get_device(1)
axis = device.get_axis(1)
axis_storage = axis.storage
```

### Methods

#### `erase_key()` (async available)

`axis_storage.erase_key(key)`

Erases the axis value stored at the provided key.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `key` | `str` | Key to erase. |

##### Return Value

Type: `bool`

A boolean indicating if the key existed.

#### `get_bool()` (async available)

`axis_storage.get_bool(key)`

Gets the value at the provided key interpreted as a boolean.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `key` | `str` | Key to get the value at. |

##### Return Value

Type: `bool`

Stored value.

#### `get_number()` (async available)

`axis_storage.get_number(key)`

Gets the value at the provided key interpreted as a number.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `key` | `str` | Key to get the value at. |

##### Return Value

Type: `float`

Stored value.

#### `get_string()` (async available)

`axis_storage.get_string(key, decode = False)`

Gets the axis value stored with the provided key.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `key` | `str` | Key to read the value of. |
| `decode` | `bool` | Whether the stored value should be decoded. Only use this when reading values set by storage.set with "encode" true. |

##### Return Value

Type: `str`

Stored value.

#### `key_exists()` (async available)

`axis_storage.key_exists(key)`

Determines whether a given key exists in axis storage.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `key` | `str` | Key which existence to determine. |

##### Return Value

Type: `bool`

True indicating that the key exists, false otherwise.

#### `list_keys()` (async available)

`axis_storage.list_keys(prefix = None)`

Lists the axis storage keys matching a given prefix. Omit the prefix to list all the keys.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `prefix` | `Optional[str]` | Optional key prefix. |

##### Return Value

Type: `List[str]`

Storage keys matching the given prefix.

#### `set_bool()` (async available)

`axis_storage.set_bool(key, value)`

Sets the value at the provided key to the provided boolean.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `key` | `str` | Key to set the value at. |
| `value` | `bool` | Value to set. |

#### `set_number()` (async available)

`axis_storage.set_number(key, value)`

Sets the value at the provided key to the provided number.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `key` | `str` | Key to set the value at. |
| `value` | `float` | Value to set. |

#### `set_string()` (async available)

`axis_storage.set_string(key, value, encode = False)`

Sets the axis value stored at the provided key.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `key` | `str` | Key to set the value at. |
| `value` | `str` | Value to set. |
| `encode` | `bool` | Whether the stored value should be base64 encoded before being stored. This makes the string unreadable to humans using the ASCII protocol, however, values stored this way can be of any length and use non-ASCII and protocol reserved characters. |
