Ejemplo n.º 1
0
 def __init__(self, url):
     self._state = None
     base_url = url.rsplit('/', 1)[0]
     self.host = urlparse(url).hostname
     xml = requests.get(url)
     self._config = deviceParser.parseString(xml.content).device
     sl = self._config.serviceList
     self.services = {}
     for svc in sl.service:
         svcname = svc.get_serviceType().split(':')[-2]
         service = Service(svc, base_url)
         service.eventSubURL = base_url + svc.get_eventSubURL()
         self.services[svcname] = service
         setattr(self, svcname, service)
Ejemplo n.º 2
0
 def __init__(self, url):
     self._state = None
     base_url = url.rsplit('/', 1)[0]
     self.host = urlparse(url).hostname
     xml = requests.get(url)
     self._config = deviceParser.parseString(xml.content).device
     sl = self._config.serviceList
     self.services = {}
     for svc in sl.service:
         svcname = svc.get_serviceType().split(':')[-2]
         service = Service(svc, base_url)
         service.eventSubURL = base_url + svc.get_eventSubURL()
         self.services[svcname] = service
         setattr(self, svcname, service)