diff options
| author | Devendra | 2014-03-24 19:17:48 +0530 |
|---|---|---|
| committer | Devendra | 2014-03-24 19:17:48 +0530 |
| commit | 80edcffbfe140a6d19c65deca24e1ba1c0f49b99 (patch) | |
| tree | 4ece6bf2a480866f1028a5765a1fac0cabb68752 /python/unassembled/Platform.py | |
| parent | 0874d7b862d8cff1c6d01f3d804a2509e181c959 (diff) | |
| download | pubnub-python-80edcffbfe140a6d19c65deca24e1ba1c0f49b99.tar.bz2 | |
support for python3
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 |
