class SynoApi(): """Class to interface with API.""" # pylint: disable=too-many-arguments, bare-except def __init__(self, host, port, username, password, temp_unit): """Constructor of the API wrapper class.""" from SynologyDSM import SynologyDSM self.temp_unit = temp_unit try: self._api = SynologyDSM(host, port, username, password) except: _LOGGER.error("Error setting up Synology DSM") # Will be updated when `update` gets called. self.utilisation = self._api.utilisation self.storage = self._api.storage @Throttle(MIN_TIME_BETWEEN_UPDATES) def update(self): """Update function for updating api information.""" self._api.update()
class SynoApi: """Class to interface with Synology DSM API.""" def __init__(self, host, port, username, password, temp_unit, use_ssl): """Initialize the API wrapper class.""" from SynologyDSM import SynologyDSM self.temp_unit = temp_unit try: self._api = SynologyDSM(host, port, username, password, use_https=use_ssl) except: # noqa: E722 pylint: disable=bare-except _LOGGER.error("Error setting up Synology DSM") # Will be updated when update() gets called. self.utilisation = self._api.utilisation self.storage = self._api.storage @Throttle(MIN_TIME_BETWEEN_UPDATES) def update(self): """Update function for updating api information.""" self._api.update()
class SynoApi(): """Class to interface with API.""" # pylint: disable=too-many-arguments, bare-except def __init__(self, host, port, username, password, temp_unit): """Constructor of the API wrapper class.""" from SynologyDSM import SynologyDSM self.temp_unit = temp_unit try: self._api = SynologyDSM(host, port, username, password) except: _LOGGER.error("Error setting up Synology DSM") def utilisation(self): """Return utilisation information from API.""" if self._api is not None: return self._api.utilisation def storage(self): """Return storage information from API.""" if self._api is not None: return self._api.storage @Throttle(MIN_TIME_BETWEEN_UPDATES) def update(self): """Update function for updating api information.""" self._api.update()
def __init__(self, host, port, username, password, temp_unit): """Constructor of the API wrapper class.""" from SynologyDSM import SynologyDSM self.temp_unit = temp_unit try: self._api = SynologyDSM(host, port, username, password) except: _LOGGER.error("Error setting up Synology DSM")
def __init__(self, host, port, username, password, temp_unit): """Initialize the API wrapper class.""" from SynologyDSM import SynologyDSM self.temp_unit = temp_unit try: self._api = SynologyDSM(host, port, username, password) except: # noqa: E722 # pylint: disable=bare-except _LOGGER.error("Error setting up Synology DSM") # Will be updated when update() gets called. self.utilisation = self._api.utilisation self.storage = self._api.storage
def __init__(self, host, port, username, password, temp_unit): """Constructor of the API wrapper class.""" from SynologyDSM import SynologyDSM self.temp_unit = temp_unit try: self._api = SynologyDSM(host, port, username, password) except: _LOGGER.error("Error setting up Synology DSM") # Will be updated when `update` gets called. self.utilisation = self._api.utilisation self.storage = self._api.storage
class SynoApi(object): """Class to interface with Synology DSM API.""" def __init__(self, host, port, username, password, temp_unit): """Initialize the API wrapper class.""" from SynologyDSM import SynologyDSM self.temp_unit = temp_unit try: self._api = SynologyDSM(host, port, username, password) except: # noqa: E722 # pylint: disable=bare-except _LOGGER.error("Error setting up Synology DSM") # Will be updated when update() gets called. self.utilisation = self._api.utilisation self.storage = self._api.storage @Throttle(MIN_TIME_BETWEEN_UPDATES) def update(self): """Update function for updating api information.""" self._api.update()
def __init__(self, host, port, username, password, temp_unit, use_ssl, api_version): """Initialize the API wrapper class.""" self.temp_unit = temp_unit try: self._api = SynologyDSM( host, port, username, password, use_https=use_ssl, debugmode=False, dsm_version=api_version, ) except: # noqa: E722 pylint: disable=bare-except _LOGGER.error("Error setting up Synology DSM") # Will be updated when update() gets called. self.utilisation = self._api.utilisation self.storage = self._api.storage
class SynoApi(): """Class to interface with API.""" # pylint: disable=too-many-arguments, bare-except def __init__(self, host, port, username, password, temp_unit): """Initialize the API wrapper class.""" from SynologyDSM import SynologyDSM self.temp_unit = temp_unit try: self._api = SynologyDSM(host, port, username, password) except: _LOGGER.error("Error setting up Synology DSM") # Will be updated when `update` gets called. self.utilisation = self._api.utilisation self.storage = self._api.storage @Throttle(MIN_TIME_BETWEEN_UPDATES) def update(self): """Update function for updating api information.""" self._api.update()