From af24fc1df02e290506275cedd971120fe0488692 Mon Sep 17 00:00:00 2001 From: Marcelo Moreira de Mello Date: Tue, 5 Jun 2018 00:08:38 -0400 Subject: [PATCH 1/2] Fixed NoneType sseclient error --- pyarlo/base_station.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/pyarlo/base_station.py b/pyarlo/base_station.py index a70d1fa..57ec94b 100644 --- a/pyarlo/base_station.py +++ b/pyarlo/base_station.py @@ -57,22 +57,28 @@ def thread_function(self): self.__sseclient = sseclient.SSEClient(data) - for event in (self.__sseclient).events(): - if not self.__subscribed: - break - data = json.loads(event.data) - if data.get('status') == "connected": - _LOGGER.debug("Successfully subscribed this base station") - elif data.get('action'): - action = data.get('action') - resource = data.get('resource') - if action == "logout": - _LOGGER.debug("Logged out by some other entity") - self.__subscribed = False + try: + for event in (self.__sseclient).events(): + if not self.__subscribed: break - elif action == "is" and "subscriptions/" not in resource: - self.__events.append(data) - self.__event_handle.set() + data = json.loads(event.data) + if data.get('status') == "connected": + _LOGGER.debug("Successfully subscribed this base station") + elif data.get('action'): + action = data.get('action') + resource = data.get('resource') + if action == "logout": + _LOGGER.debug("Logged out by some other entity") + self.__subscribed = False + break + elif action == "is" and "subscriptions/" not in resource: + self.__events.append(data) + self.__event_handle.set() + + except TypeError as error: + _LOGGER.debug("Got unexpected error: %s", error) + return None + return True def _get_event_stream(self): From 10f4f3158bd9912b25ff336d70a44ede4710f97b Mon Sep 17 00:00:00 2001 From: Marcelo Moreira de Mello Date: Tue, 5 Jun 2018 00:21:06 -0400 Subject: [PATCH 2/2] Bump devel version 0.1.4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 59186e8..30cfc8d 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name='pyarlo', packages=['pyarlo'], - version='0.1.3', + version='0.1.4', description='Python Arlo is a library written in Python 2.7/3x ' + 'that exposes the Netgear Arlo cameras as Python objects.', author='Marcelo Moreira de Mello',