diff options
Diffstat (limited to 'python/unassembled/Platform.py')
| -rw-r--r-- | python/unassembled/Platform.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/python/unassembled/Platform.py b/python/unassembled/Platform.py index f598a98..627a350 100644 --- a/python/unassembled/Platform.py +++ b/python/unassembled/Platform.py @@ -1,3 +1,4 @@ +import urllib3 class Pubnub(PubnubCore): def __init__( @@ -18,7 +19,8 @@ class Pubnub(PubnubCore): ssl_on = ssl_on, origin = origin, uuid = pres_uuid - ) + ) + self.http = urllib3.PoolManager(timeout=310) def _request( self, request, callback = None ) : ## Build URL @@ -26,11 +28,8 @@ class Pubnub(PubnubCore): ## Send Request Expecting JSONP Response try: - try: usock = urllib2.urlopen( url, None, 310 ) - except TypeError: usock = urllib2.urlopen( url, None ) - response = usock.read() - usock.close() - resp_json = json.loads(response) + response = self.http.request('GET', url) + resp_json = json.loads(response.data.decode("utf-8")) except: return None |
