aboutsummaryrefslogtreecommitdiffstats
path: root/python/unassembled/Platform.py
diff options
context:
space:
mode:
authorDevendra2013-12-18 23:23:22 +0530
committerDevendra2013-12-18 23:23:22 +0530
commit786390e9ee0024ab3061a9133700457b07ae0f80 (patch)
tree0aa0acda65ed1c51c68f138c0114055f6769374c /python/unassembled/Platform.py
parent1d601e3411af27c1b39e697849a538b692a535e7 (diff)
downloadpubnub-python-786390e9ee0024ab3061a9133700457b07ae0f80.tar.bz2
adding pam client support to python sdk
Diffstat (limited to 'python/unassembled/Platform.py')
-rw-r--r--python/unassembled/Platform.py15
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):