berconpy.AsyncCommander

class berconpy.AsyncCommander(*, command_attempts=3, command_interval=1.0)

Bases: object

Handles sending commands and waiting for responses.

Methods

cancel_command(sequence)

Cancels a command in the protocol along with its associated future.

reset()

send_command(command)

set_command(sequence, message)

Notifies the future waiting on a command response packet.

wait_for_command(sequence)

Returns a future waiting for a command response with the given sequence number.

Attributes

io_layer

proto_layer

cancel_command(sequence)

Cancels a command in the protocol along with its associated future.

If the protocol is not logged in, usually due to a timeout or the client closing, this is a no-op. Cancellation should instead be handled by calling reset().

If the command sequence was not queued before, this is a no-op.

Return type:

None

set_command(sequence, message)

Notifies the future waiting on a command response packet.

An alternative message may be given if the packet itself does not contain the full message (i.e. multipart packet).

If no future was created for the packet, this is a no-op.

Return type:

None

wait_for_command(sequence)

Returns a future waiting for a command response with the given sequence number.

Return type:

Future[str]