Utilities¶
-
class
batou.utils.
Address
(connect_address, port=None)¶ An internet service address that can be listened and connected to.
The constructor address is expected to be the address that can be connected to. The listen address will be computed automatically.
>>> x = Address('localhost', 80) >>> str(x.connect) 'localhost:80' >>> str(x.listen) '127.0.0.1:80'
-
connect
= None¶ The connect address as it should be used when configuring clients. This is a
batou.utils.NetLoc
object.
-
listen
= None¶ The listen (or bind) address as it should be used when configuring servers. This is a
batou.utils.NetLoc
object.
-
listen_v6
= None¶ The IPv6 listen (or bind) address as it should be used when configuring servers. This is a
batou.utils.NetLoc
object or None, if there is no IPv6 address.
-
-
exception
batou.utils.
CmdExecutionError
(cmd, returncode, stdout, stderr)¶
-
exception
batou.utils.
CycleError
¶
-
class
batou.utils.
NetLoc
(host, port=None)¶ A network location specified by host and port.
Network locations can automatically render an appropriate string representation:
>>> x = NetLoc('127.0.0.1') >>> x.host '127.0.0.1' >>> x.port None >>> str(x) '127.0.0.1' >>> y = NetLoc('127.0.0.1', 80) >>> str(y) '127.0.0.1:80'
-
host
= None¶ The host part of this network location. Can be a hostname or IP address.
-
port
= None¶ The port of this network location. Can be
None
or an integer.
-