You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

22 lines
638 B

from netdisco.ssdp import scan
from .upnp import Device
from .util import _getLogger
def discover(timeout=5):
"""
Convenience method to discover UPnP devices on the network. Returns a
list of `upnp.Device` instances. Any invalid servers are silently
ignored.
"""
devices = {}
for entry in scan(timeout):
if entry.location in devices:
continue
try:
devices[entry.location] = Device(entry.location)
except Exception as exc:
log = _getLogger("ssdp")
log.error('Error \'%s\' for %s', exc, entry.location)
return list(devices.values())