diff options
| author | Devendra | 2014-04-23 21:35:06 +0530 | 
|---|---|---|
| committer | Devendra | 2014-04-23 21:35:06 +0530 | 
| commit | f7b89bfafae34fa22509c1d1c59d1284ec62c5df (patch) | |
| tree | 2eeaf63f906ade16c82c86844e8f76b191b9ad6c /python/Pubnub.py | |
| parent | 1d97c69f186719fe007a4fa0033d39d9a68a4e43 (diff) | |
| download | pubnub-python-f7b89bfafae34fa22509c1d1c59d1284ec62c5df.tar.bz2 | |
exception handling changes
Diffstat (limited to 'python/Pubnub.py')
| -rw-r--r-- | python/Pubnub.py | 37 | 
1 files changed, 15 insertions, 22 deletions
| diff --git a/python/Pubnub.py b/python/Pubnub.py index 93f416b..3bf02a3 100644 --- a/python/Pubnub.py +++ b/python/Pubnub.py @@ -186,7 +186,7 @@ import sys  try:      from urllib.parse import quote -except: +except ImportError:      from urllib2 import quote  from base64 import urlsafe_b64encode @@ -397,7 +397,7 @@ class PubnubBase(object):          """ -        message = self.encrypt(args['message']) +        message = self.encrypt(message)          ## Send Message          return self._request({"urlcomponents": [ @@ -458,15 +458,6 @@ class PubnubBase(object):          print(here_now['uuids'])          """ -        channel = str(args['channel']) - -        callback = args['callback'] if 'callback' in args else None -        error = args['error'] if 'error' in args else None - -        ## Fail if bad input. -        if not channel: -            raise Exception('Missing Channel') -            return False          ## Get Presence Here Now          return self._request({"urlcomponents": [ @@ -807,21 +798,23 @@ class PubnubCoreAsync(PubnubBase):                  return              ## CONNECT TO PUBNUB SUBSCRIBE SERVERS -            try: -                self.SUB_RECEIVER = self._request({"urlcomponents": [ -                    'subscribe', -                    self.subscribe_key, -                    channel_list, -                    '0', -                    str(self.timetoken) -                ], "urlparams": {"uuid": self.uuid, "auth": self.auth_key}}, -                    sub_callback, -                    sub_callback, -                    single=True) +            #try: +            self.SUB_RECEIVER = self._request({"urlcomponents": [ +                'subscribe', +                self.subscribe_key, +                channel_list, +                '0', +                str(self.timetoken) +            ], "urlparams": {"uuid": self.uuid, "auth": self.auth_key}}, +                sub_callback, +                sub_callback, +                single=True) +            '''              except Exception as e:                  print(e)                  self.timeout(1, _connect)                  return +            '''          self._connect = _connect | 
