From 276bf54fcccd73cf694487d59e9e3319b8bd8616 Mon Sep 17 00:00:00 2001 From: Devendra Date: Fri, 19 Jun 2015 03:27:23 +0530 Subject: history fix --- pubnub.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'pubnub.py') diff --git a/pubnub.py b/pubnub.py index 775123c..3b9a488 100644 --- a/pubnub.py +++ b/pubnub.py @@ -919,11 +919,14 @@ class PubnubBase(object): """ def _get_decrypted_history(resp): - if resp and resp[1] is not None and self.cipher_key: - msgs = resp[0] - for i in range(0,len(msgs)): - msgs[i] = self.decrypt(msgs[i]) - return resp + try: + if resp and resp[1] is not None and self.cipher_key: + msgs = resp[0] + for i in range(0,len(msgs)): + msgs[i] = self.decrypt(msgs[i]) + except KeyError: + pass + return resp def _history_callback(resp): if callback is not None: @@ -940,7 +943,7 @@ class PubnubBase(object): params['reverse'] = reverse params['start'] = start params['end'] = end - params['auth_key'] = self.auth_key + params['auth'] = self.auth_key params['pnsdk'] = self.pnsdk params['include_token'] = 'true' if include_token else 'false' @@ -2187,7 +2190,7 @@ class Pubnub(PubnubCore): if callback is None: return get_data_for_user(self._request_sync(request, timeout=timeout)) else: - self._request_async(request, callback, error, single=single, timeout=timeout) + return self._request_async(request, callback, error, single=single, timeout=timeout) # Pubnub Twisted -- cgit v1.2.3