zeroless package

Submodules

zeroless.zeroless module

The Zeroless module API.

zeroless.zeroless.log[source]

A global Logger object. To use it, just add an Handler object and set an appropriate logging level.

class zeroless.zeroless.Client[source]

Bases: zeroless.zeroless.Sock

A client that can connect to a set of servers.

addresses

Returns a tuple containing all the connected addresses. Each address is a tuple with an ip address and a port.

Return type:(addresses)
connect(ip, port)[source]

Connects to a server at the specified ip and port.

Parameters:
  • ip (str or unicode) – an IP address
  • port (int) – port number from 1024 up to 65535
connect_local(port)[source]

Connects to a server in localhost at the specified port.

Parameters:port (int) – port number from 1024 up to 65535
disconnect(ip, port)[source]

Disconnects from a server at the specified ip and port.

Parameters:
  • ip (str or unicode) – an IP address
  • port (int) – port number from 1024 up to 65535
disconnect_all()[source]

Disconnects from all connected servers.

disconnect_local(port)[source]

Disconnects from a server in localhost at the specified port.

Parameters:port (int) – port number from 1024 up to 65535
class zeroless.zeroless.Server(port)[source]

Bases: zeroless.zeroless.Sock

A server that clients can connect to.

port

Returns the port.

Return type:int
class zeroless.zeroless.Sock[source]
pair()[source]

Returns a callable and an iterable respectively. Those can be used to both transmit a message and/or iterate over incoming messages, that were sent by a pair socket. Note that the iterable returns as many parts as sent by a pair. Also, the sender function has a print like signature, with an infinite number of arguments. Each one being a part of the complete message.

Return type:(function, generator)
pub(topic='', embed_topic=False)[source]

Returns a callable that can be used to transmit a message, with a given topic, in a publisher-subscriber fashion. Note that the sender function has a print like signature, with an infinite number of arguments. Each one being a part of the complete message.

Parameters:
  • topic (bytes) – the topic that will be published to (default=b’‘)
  • embed_topic – set to embed the topic into published messages (default=False)

:type embed_topic bool :rtype: function

pull()[source]

Returns an iterable that can be used to iterate over incoming messages, that were pushed by a push socket. Note that the iterable returns as many parts as sent by pushers.

Return type:generator
push()[source]

Returns a callable that can be used to transmit a message in a push-pull fashion. Note that the sender function has a print like signature, with an infinite number of arguments. Each one being a part of the complete message.

Return type:function
reply()[source]

Returns a callable and an iterable respectively. Those can be used to both transmit a message and/or iterate over incoming messages, that were requested by a request socket. Note that the iterable returns as many parts as sent by requesters. Also, the sender function has a print like signature, with an infinite number of arguments. Each one being a part of the complete message.

Return type:(function, generator)
request()[source]

Returns a callable and an iterable respectively. Those can be used to both transmit a message and/or iterate over incoming messages, that were replied by a reply socket. Note that the iterable returns as many parts as sent by repliers. Also, the sender function has a print like signature, with an infinite number of arguments. Each one being a part of the complete message.

Return type:(function, generator)
sub(topics=('', ))[source]

Returns an iterable that can be used to iterate over incoming messages, that were published with one of the topics specified in topics. Note that the iterable returns as many parts as sent by subscribed publishers.

Parameters:topics (list of bytes) – a list of topics to subscribe to (default=b’‘)
Return type:generator

Module contents