# API Reference v10.3.1 (Python)

## Transport (class)

Module: zaber_motion.ascii

Connection transport backend allowing to carry Zaber ASCII protocol over arbitrary protocols. Can only be used with a single connection.

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

```py
from zaber_motion.ascii import Transport

transport = Transport.open()
```

Related Guides:

- [Custom transports](https://software.zaber.com/motion-library/docs/guides/advanced/custom_transports.md)

### Properties

#### `transport_id` (read-only)

`transport.transport_id`

Type: `int`

The transport ID identifies this transport instance with the underlying library.

### Methods

#### `close()` (async available)

`transport.close()`

Closes the transport. Also closes the connection using the transport.

#### `close_with_error()` (async available)

`transport.close_with_error(error_message)`

Closes the transport with error. Also closes the connection using the transport propagating the error.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `error_message` | `str` | Error to be propagated. |

(static)

#### `open()`

`Transport.open()`

Creates new instance allowing to read/write messages from/to a single connection.

##### Return Value

Type: [`Transport`](https://software.zaber.com/motion-library/api/py/ascii/transport.md)

New instance of transport.

#### `read()` (async available)

`transport.read()`

Reads a single message generated by the connection. The message is a request for the device. Read should be called continuously in a loop to ensure all generated messages are processed. Subsequent read call confirms that previous message was delivered to the device.

##### Return Value

Type: `str`

Message generated by the connection.

#### `write()` (async available)

`transport.write(message)`

Writes a single message to the connection. The message will be processed as a reply from the device.

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `message` | `str` | Single message of Zaber ASCII protocol. |
