From e0207efea24574bc6dac3e0aadb2d53cebe2a307 Mon Sep 17 00:00:00 2001 From: Devendra Date: Fri, 2 May 2014 22:45:17 +0530 Subject: console enhancements --- Pubnub.py | 6 ++++-- python/examples/console.py | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Pubnub.py b/Pubnub.py index fc822f7..75e2243 100644 --- a/Pubnub.py +++ b/Pubnub.py @@ -874,13 +874,13 @@ class PubnubCoreAsync(PubnubBase): if ch[1] in self.subscriptions: chobj = self.subscriptions[ch[1]] _invoke(chobj['callback'], - self.decrypt(response_list[ch[0]])) + self.decrypt(response_list[ch[0]]), chobj['name']) else: response_list = response[0] chobj = _get_channel() for r in response_list: if chobj: - _invoke(chobj['callback'], self.decrypt(r)) + _invoke(chobj['callback'], self.decrypt(r), chobj['name']) _connect() @@ -1133,6 +1133,8 @@ def _requests_request(url, timeout=320): msg = str(error) return (json.dumps(msg), 0) except requests.exceptions.Timeout as error: + #print(error); + #print('timeout'); msg = str(error) return (json.dumps(msg), 0) diff --git a/python/examples/console.py b/python/examples/console.py index d43ee80..3041a02 100644 --- a/python/examples/console.py +++ b/python/examples/console.py @@ -122,11 +122,11 @@ def _publish_command_handler(channel, message,async=False): def _subscribe_command_handler(channel): - def _callback(r): - print_ok(r, channel) + def _callback(r,ch): + print_ok(r, ch) - def _error(r): - print_error(r, channel) + def _error(r,ch=None): + print_error(r, ch if ch is not None else channel) def _disconnect(r): print_error("DISCONNECTED", r) -- cgit v1.2.3