diff options
Diffstat (limited to 'python/unassembled')
| -rw-r--r-- | python/unassembled/Platform.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/python/unassembled/Platform.py b/python/unassembled/Platform.py index f598a98..5b7e8a8 100644 --- a/python/unassembled/Platform.py +++ b/python/unassembled/Platform.py @@ -8,7 +8,8 @@ class Pubnub(PubnubCore): cipher_key = False, ssl_on = False, origin = 'pubsub.pubnub.com', - pres_uuid = None + pres_uuid = None, + auth_key = None ) : super(Pubnub, self).__init__( publish_key = publish_key, @@ -17,21 +18,25 @@ class Pubnub(PubnubCore): cipher_key = cipher_key, ssl_on = ssl_on, origin = origin, - uuid = pres_uuid + uuid = pres_uuid, + auth_key = auth_key ) def _request( self, request, callback = None ) : ## Build URL url = self.getUrl(request) + usock = None + response = None ## Send Request Expecting JSONP Response try: try: usock = urllib2.urlopen( url, None, 310 ) + except urllib2.HTTPError, e: response = e.fp.read() except TypeError: usock = urllib2.urlopen( url, None ) - response = usock.read() - usock.close() + if (response == None): response = usock.read() + if (usock != None): usock.close() resp_json = json.loads(response) - except: + except Exception as e: return None if (callback): |
