From 07d7206c85c88b768944fe7bcc2d514230d2bff5 Mon Sep 17 00:00:00 2001 From: Marcelo Moreira de Mello Date: Wed, 29 Nov 2017 04:29:04 -0500 Subject: [PATCH 1/5] Bump version to 0.2.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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', From 392a1c3cfcdbf68ad1827391477dcc9e51e26228 Mon Sep 17 00:00:00 2001 From: Andrew Kress Date: Tue, 9 Jan 2018 08:21:34 -0600 Subject: [PATCH 2/5] move the _save_cache(self.cache, self.cache_file) inside the if statement so when we are not reusing the session it does not attempt to persist the token to disk. --- ring_doorbell/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ring_doorbell/__init__.py b/ring_doorbell/__init__.py index 9e18f0a2..a419cbf9 100644 --- a/ring_doorbell/__init__.py +++ b/ring_doorbell/__init__.py @@ -131,8 +131,8 @@ 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 From 28cdfc73d5cd0ee5cd2220b5075ae7db685960d4 Mon Sep 17 00:00:00 2001 From: Andrew Kress Date: Tue, 9 Jan 2018 08:30:44 -0600 Subject: [PATCH 3/5] fix indentation --- ring_doorbell/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ring_doorbell/__init__.py b/ring_doorbell/__init__.py index a419cbf9..a315b29c 100644 --- a/ring_doorbell/__init__.py +++ b/ring_doorbell/__init__.py @@ -131,7 +131,7 @@ 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 From d2f242ef5920717e1535a18af30bffb83f4e4722 Mon Sep 17 00:00:00 2001 From: Marcelo Moreira de Mello Date: Tue, 15 May 2018 23:55:07 -0400 Subject: [PATCH 4/5] Makes lint happy --- ring_doorbell/__init__.py | 1 + ring_doorbell/doorbot.py | 1 + ring_doorbell/utils.py | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ring_doorbell/__init__.py b/ring_doorbell/__init__.py index a315b29c..c1bff70d 100644 --- a/ring_doorbell/__init__.py +++ b/ring_doorbell/__init__.py @@ -137,6 +137,7 @@ def _authenticate(self, attempts=RETRY_TOKEN, session=None): 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..39c6921b 100644 --- a/ring_doorbell/doorbot.py +++ b/ring_doorbell/doorbot.py @@ -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) From 1e08c4283dec56a59460d6f6a277d1fa74b37f72 Mon Sep 17 00:00:00 2001 From: Marcelo Moreira de Mello Date: Tue, 15 May 2018 23:58:14 -0400 Subject: [PATCH 5/5] Fixes #86 - Make sure battery_life argument exists before comparison value = int(self._attrs.get('battery_life')) TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' --- ring_doorbell/doorbot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ring_doorbell/doorbot.py b/ring_doorbell/doorbot.py index 39c6921b..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