protocol.py

tcprocd protocol.

exception tcprocd.protocol.ProtocolError[source]

Bases: Exception

Exception, raised on protocol errors.

exception tcprocd.protocol.Disconnect[source]

Bases: Exception

Exception, raised on disconnect.

class tcprocd.protocol.Protocol(socket, timeout=2)[source]

Bases: object

The tcprocd protocol.

Parameters:
  • socket – socket to use for sending/receiving
  • timeout – default timeout between messages
OK = 'OK'
OFFLINE = 'OFFLINE'
EXISTS = 'EXISTS'
UNKNOWN = 'UNKNOWN'
PERMISSION_DENIED = 'PERMISSION_DENIED'
ERROR = 'PROTOCOL_ERROR'
AUTHENTICATION_REQUIRED = 'AUTHENTICATION_REQUIRED'
AUTHENTICATION_ERROR = 'AUTHENTICATION_ERROR'
set_timeout(timeout=None)[source]

Set the given timeout or reset if not given.

_recv(l)[source]
recv_part(prefix_numbers)[source]

Receive a string prefixed by the given length and return it.

readline()[source]

Receive a line and return it.

sendline(line)[source]

Send a line.

send_part(prefix_numbers, s)[source]

Send a string prefixed by its length.