mdns_beacon package

Submodules

mdns_beacon.base module

Base mDNS Beacon module.

class mdns_beacon.base.BaseBeacon(ip_version: Optional[zeroconf.IPVersion] = None)[source]

Bases: abc.ABC

mDNS Beacon base class.

Note

Derived beacons must override the _execute method.

ip_version

IP protocol version to use.

run_forever()None[source]

Run beacon forever.

stop()None[source]

Stop Beacon.

Ends zeroconf background threads, and prevent zeroconf instance from servicing further queries.

property zeroconf

Zeroconf instance.

mdns_beacon.beacon module

Beacon module.

class mdns_beacon.beacon.Beacon(aliases: Optional[List[str]] = None, addresses: Optional[List[Union[ipaddress.IPv4Address, ipaddress.IPv6Address]]] = None, port: int = 80, type_: str = 'http', protocol: Literal[tcp, udp] = 'tcp', ttl: int = 60, weight: int = 0, priority: int = 0, properties: Optional[Union[bytes, Dict[str, Any]]] = None, delay_startup: int = 0, *args: Any, **kwargs: Any)[source]

Bases: mdns_beacon.base.BaseBeacon

mDNS Beacon.

aliases

Service alias name list.

addresses

IP addresses that the service runs on.

port

Port that the service runs on.

type_

Service type.

protocol

Service protocol.

ttl

TTL used for the announce of the service.

weight

Weight of the service.

priority

Priority of the service.

properties

Dict of properties (or a bytes object with the content of the text field).

delay_startup

Amount of time to wait before trying to start the zeroconf service (in seconds).

\*args

Variable length argument list.

\*\*kwargs

Arbitrary keyword arguments.

property service_type

Beacon service type.

property services

Services to register on the local network.

stop()None[source]

Stop Beacon.

Unregister all the announced services.

mdns_beacon.listener module

mDNS listener module.

class mdns_beacon.listener.BeaconListener(handlers: Union[zeroconf.ServiceListener, List[Callable[[], None]]], services: Optional[List[str]] = None, timeout: Union[int, float] = 5, *args: Any, **kwargs: Any)[source]

Bases: mdns_beacon.base.BaseBeacon

mDNS Beacon listener.

handlers

Service listeners or functions to be called when a service is added, updated or removed.

services

Fully qualified service type names list.

timeout

Seconds to wait for any responses.

property default_services

Return default services to listen on local networks.

Module contents

Top-level package for mdns-beacon.