servicediscovery module

class servicediscovery.Listener[source]

Bases: object

Parent class for Listener implementations. Each method corresponds to an event type. Subclasses override the desired methods with the code to be invoked upon those events. The default methods are all no-ops. An instance of a Listener implementation is required to initialize a ServiceBrowser.

add_service(sname, stype, sdomain, host, port, properties)[source]
all_for_now()[source]
failure(*args)[source]
remove_service(sname, stype, sdomain)[source]
class servicediscovery.Publisher[source]

Bases: object

Glue code to connect to the avahi daemon through dbus and manage the advertisement of services.

add_service(sname, port, stype=None, sdomain=None, host=None, properties=None, commit=True)[source]

See the Service class for the meaning of the arguments.

If commit is True (the default), then the new service is advertised immediately along with all other previously unadvertised services; otherwise the calling code is responsible for calling the .commit() method itself.

commit()[source]
class servicediscovery.ServiceBrowser(listener, stype='_http._tcp', sdomain='gw.local', ignore_local=False)[source]

Bases: object

Glue code to connect a Listener implementation to the avahi daemon through dbus.

allfornow_handler(bus, sender_name, object_path, interface_name, signal_name, parameters, data)[source]

Internal AllForNow signal handler. Forwards the essential information to the Listener’s .all_for_now() method.

failure_handler(bus, sender_name, object_path, interface_name, signal_name, parameters, data)[source]

Internal Failure signal handler. Forwards the essential information to the Listener’s .failure() method.

itemnew_handler(bus, sender_name, object_path, interface_name, signal_name, service_config, data)[source]

Internal ItemNew signal handler. Forwards the essential information to the Listener’s .add_service() method.

itemremove_handler(bus, sender_name, object_path, interface_name, signal_name, service_config, data)[source]

Internal ItemRemove signal handler. Forwards the essential information to the Listener’s .remove_service() method.