diff --git a/homeassistant/components/digital_ocean.py b/homeassistant/components/digital_ocean.py index 6ba2c824859..bd03fb01975 100644 --- a/homeassistant/components/digital_ocean.py +++ b/homeassistant/components/digital_ocean.py @@ -13,7 +13,7 @@ from homeassistant.const import CONF_ACCESS_TOKEN from homeassistant.util import Throttle import homeassistant.helpers.config_validation as cv -REQUIREMENTS = ['python-digitalocean==1.12'] +REQUIREMENTS = ['python-digitalocean==1.13.2'] _LOGGER = logging.getLogger(__name__) @@ -44,13 +44,19 @@ CONFIG_SCHEMA = vol.Schema({ def setup(hass, config): """Set up the Digital Ocean component.""" + import digitalocean + conf = config[DOMAIN] access_token = conf.get(CONF_ACCESS_TOKEN) digital = DigitalOcean(access_token) - if not digital.manager.get_account(): - _LOGGER.error("No Digital Ocean account found for the given API Token") + try: + if not digital.manager.get_account(): + _LOGGER.error("No account found for the given API token") + return False + except digitalocean.baseapi.DataReadError: + _LOGGER.error("API token not valid for authentication") return False hass.data[DATA_DIGITAL_OCEAN] = digital diff --git a/requirements_all.txt b/requirements_all.txt index 5c9158448fc..f7b11f7a338 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -836,7 +836,7 @@ python-blockchain-api==0.0.2 python-clementine-remote==1.0.1 # homeassistant.components.digital_ocean -python-digitalocean==1.12 +python-digitalocean==1.13.2 # homeassistant.components.ecobee python-ecobee-api==0.0.14