From 4a14f1f57546a7ccb24b9ced41f5743c3f49f96e Mon Sep 17 00:00:00 2001 From: Devendra Date: Wed, 7 May 2014 18:11:35 +0530 Subject: check for channel length 0 in subscribe --- Pubnub.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Pubnub.py') diff --git a/Pubnub.py b/Pubnub.py index ee9371a..4ae27ab 100644 --- a/Pubnub.py +++ b/Pubnub.py @@ -806,8 +806,9 @@ class PubnubCoreAsync(PubnubBase): channels, list) else channels.split(",") for channel in channels: ## New Channel? - if not channel in self.subscriptions or \ - self.subscriptions[channel]['subscribed'] is False: + if len(channel) > 0 and \ + (not channel in self.subscriptions or + self.subscriptions[channel]['subscribed'] is False): with self._channel_list_lock: self.subscriptions[channel] = { 'name': channel, @@ -1131,12 +1132,14 @@ def _requests_request(url, timeout=320): try: resp = s.get(url, timeout=timeout) except requests.exceptions.HTTPError as http_error: + print http_error resp = http_error except requests.exceptions.ConnectionError as error: + print error msg = str(error) return (json.dumps(msg), 0) except requests.exceptions.Timeout as error: - #print(error); + print(error) #print('timeout'); msg = str(error) return (json.dumps(msg), 0) -- cgit v1.2.3