diff --git a/ring_doorbell/__init__.py b/ring_doorbell/__init__.py index 9e18f0a2..c1bff70d 100644 --- a/ring_doorbell/__init__.py +++ b/ring_doorbell/__init__.py @@ -131,12 +131,13 @@ def _authenticate(self, attempts=RETRY_TOKEN, session=None): if self._reuse_session: self.cache['account'] = self.username self.cache['token'] = self.token + _save_cache(self.cache, self.cache_file) - _save_cache(self.cache, self.cache_file) return True self.is_connected = False req.raise_for_status() + return True def query(self, url, diff --git a/ring_doorbell/doorbot.py b/ring_doorbell/doorbot.py index c67d1858..8e986b3b 100644 --- a/ring_doorbell/doorbot.py +++ b/ring_doorbell/doorbot.py @@ -30,8 +30,8 @@ def family(self): @property def battery_life(self): """Return battery life.""" - value = int(self._attrs.get('battery_life')) - if value > 100: + value = self._attrs.get('battery_life') + if value and value > 100: value = 100 return value @@ -270,6 +270,7 @@ def recording_download(self, recording_id, filename=None, override=False): except IOError as error: _LOGGER.error("%s", error) raise + return False def recording_url(self, recording_id): """Return HTTPS recording URL.""" diff --git a/ring_doorbell/utils.py b/ring_doorbell/utils.py index a5cc2814..a094ee1c 100644 --- a/ring_doorbell/utils.py +++ b/ring_doorbell/utils.py @@ -55,4 +55,5 @@ def _read_cache(filename): return data except (EOFError, ValueError): - return _clean_cache(filename) + pass + return _clean_cache(filename) diff --git a/setup.py b/setup.py index 6311805e..4de51719 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name='ring_doorbell', packages=['ring_doorbell'], - version='0.1.9', + version='0.2.0', description='A Python library to communicate with Ring' + ' Door Bell (https://ring.com/)', author='Marcelo Moreira de Mello',