def loadDeviceDefinitions(self, urlOfXMLDefinition, timeout=3):
        """Loads the device definitions from a given URL which points to the root XML in the device.

        This loads the device definitions which is needed in case you like to:

        * get additional information's about the device like manufacture, device type, etc
        * get all support service types of this device
        * use the convenient actions classes part of this library in the actions module

        :param str urlOfXMLDefinition: the URL to the root XML which sets the device definitions.
        :param float timeout: the timeout for downloading
        :raises ValueError: if the XML could not be parsed correctly
        :raises requests.exceptions.ConnectionError: when the device definitions can not be downloaded
        :raises requests.exceptions.ConnectTimeout: when download time out

        .. seealso::

            :meth:`~simpletr64.DeviceTR64.loadSCPD`, :meth:`~simpletr64.DeviceTR64.deviceServiceDefinitions`,
            :meth:`~simpletr64.DeviceTR64.deviceInformations`, :meth:`~simpletr64.DeviceTR64.deviceSCPD`,
            :meth:`~simpletr64.DeviceTR64.getSCDPURL`, :meth:`~simpletr64.DeviceTR64.getControlURL`,
            :meth:`~simpletr64.DeviceTR64.getEventSubURL`
        """

        # setup proxies
        proxies = {}
        if self.__httpsProxy:
            proxies = {"https": self.__httpsProxy}

        if self.__httpProxy:
            proxies = {"http": self.__httpProxy}

        # some devices response differently without a User-Agent
        headers = {"User-Agent": "Mozilla/5.0; SimpleTR64-1"}

        # setup authentication
        auth = None
        if self.__password:
            auth = HTTPDigestAuth(self.__username, self.__password)

        # get the content
        request = requests.get(urlOfXMLDefinition, proxies=proxies, headers=headers, timeout=float(timeout),
                               auth=auth, verify=self.__verify)

        if request.status_code != 200:
            errorStr = DeviceTR64._extractErrorString(request)
            raise ValueError('Could not get CPE definitions "' + urlOfXMLDefinition + '" : ' +
                             str(request.status_code) + ' - ' + request.reason + " -- " + errorStr)

        # parse XML return
        xml = request.text.encode('utf-8')

        return self._loadDeviceDefinitions(urlOfXMLDefinition, xml)
def loadDeviceDefinitions ( self , urlOfXMLDefinition , timeout = 3 ) : proxies = { } if self . __httpsProxy : proxies = { "https" : self . __httpsProxy } if self . __httpProxy : proxies = { "http" : self . __httpProxy } headers = { "User-Agent" : "Mozilla/5.0; SimpleTR64-1" } auth = None if self . __password : auth = HTTPDigestAuth ( self . __username , self . __password ) request = requests . get ( urlOfXMLDefinition , proxies = proxies , headers = headers , timeout = float ( timeout ) , auth = auth , verify = self . __verify ) if request . status_code != 200 : errorStr = DeviceTR64 . _extractErrorString ( request ) raise ValueError ( 'Could not get CPE definitions "' + urlOfXMLDefinition + '" : ' + str ( request . status_code ) + ' - ' + request . reason + " -- " + errorStr ) xml = request . text . encode ( 'utf-8' ) return self . _loadDeviceDefinitions ( urlOfXMLDefinition , xml )
Loads the device definitions from a given URL which points to the root XML in the device.

        This loads the device definitions which is needed in case you like to:

        * get additional information's about the device like manufacture, device type, etc
        * get all support service types of this device
        * use the convenient actions classes part of this library in the actions module

        :param str urlOfXMLDefinition: the URL to the root XML which sets the device definitions.
        :param float timeout: the timeout for downloading
        :raises ValueError: if the XML could not be parsed correctly
        :raises requests.exceptions.ConnectionError: when the device definitions can not be downloaded
        :raises requests.exceptions.ConnectTimeout: when download time out

        .. seealso::

            :meth:`~simpletr64.DeviceTR64.loadSCPD`, :meth:`~simpletr64.DeviceTR64.deviceServiceDefinitions`,
            :meth:`~simpletr64.DeviceTR64.deviceInformations`, :meth:`~simpletr64.DeviceTR64.deviceSCPD`,
            :meth:`~simpletr64.DeviceTR64.getSCDPURL`, :meth:`~simpletr64.DeviceTR64.getControlURL`,
            :meth:`~simpletr64.DeviceTR64.getEventSubURL`