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 /common/PubnubCore.py | |
| parent | 1d97c69f186719fe007a4fa0033d39d9a68a4e43 (diff) | |
| download | pubnub-python-f7b89bfafae34fa22509c1d1c59d1284ec62c5df.tar.bz2 | |
exception handling changes
Diffstat (limited to 'common/PubnubCore.py')
| -rw-r--r-- | common/PubnubCore.py | 20 | 
1 files changed, 3 insertions, 17 deletions
| diff --git a/common/PubnubCore.py b/common/PubnubCore.py index 1c00215..8454797 100644 --- a/common/PubnubCore.py +++ b/common/PubnubCore.py @@ -45,7 +45,7 @@ class PubnubCore(PubnubCoreAsync):          self.version = '3.4'          self.accept_encoding = 'gzip' -    def subscribe_sync(self, args): +    def subscribe_sync(self, channel, callback, timetoken=0):          """          #**          #* Subscribe @@ -69,25 +69,11 @@ class PubnubCore(PubnubCoreAsync):          """ -        ## Fail if missing channel -        if not 'channel' in args: -            raise Exception('Missing Channel.') -            return False - -        ## Fail if missing callback -        if not 'callback' in args: -            raise Exception('Missing Callback.') -            return False - -        ## Capture User Input -        channel = str(args['channel']) -        callback = args['callback'] -        subscribe_key = args.get('subscribe_key') or self.subscribe_key +        subscribe_key = self.subscribe_key          ## Begin Subscribe          while True: -            timetoken = 'timetoken' in args and args['timetoken'] or 0              try:                  ## Wait for Message                  response = self._request({"urlcomponents": [ @@ -99,7 +85,7 @@ class PubnubCore(PubnubCoreAsync):                  ], "urlparams": {"uuid": self.uuid}})                  messages = response[0] -                args['timetoken'] = response[1] +                timetoken = response[1]                  ## If it was a timeout                  if not len(messages): | 
