aboutsummaryrefslogtreecommitdiffstats
path: root/common/PubnubBase.py
diff options
context:
space:
mode:
authorDevendra2014-03-25 11:47:03 +0530
committerDevendra2014-03-25 11:47:03 +0530
commit9ac3ccf6283772b404a0c80945e3cdf3406ac5bf (patch)
tree11ff9dc1a4e585617a522bc9cb56172dfa4adda9 /common/PubnubBase.py
parentb8d1dd86a0d8c4261d4f3765f3ca227d7b555c84 (diff)
downloadpubnub-python-9ac3ccf6283772b404a0c80945e3cdf3406ac5bf.tar.bz2
making version 2 and version 3 work same timepython3
Diffstat (limited to 'common/PubnubBase.py')
-rw-r--r--common/PubnubBase.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/common/PubnubBase.py b/common/PubnubBase.py
index b8817c1..4c5b422 100644
--- a/common/PubnubBase.py
+++ b/common/PubnubBase.py
@@ -3,7 +3,8 @@ except ImportError: import simplejson as json
import time
import hashlib
-import uuid
+import uuid
+import sys
class PubnubBase(object):
def __init__(
@@ -41,7 +42,7 @@ class PubnubBase(object):
self.secret_key = secret_key
self.cipher_key = cipher_key
self.ssl = ssl_on
- self.pc = PubnubCrypto()
+
if self.ssl :
self.origin = 'https://' + self.origin
@@ -49,6 +50,14 @@ class PubnubBase(object):
self.origin = 'http://' + self.origin
self.uuid = UUID or str(uuid.uuid4())
+
+ if type(sys.version_info) is tuple:
+ self.python_version = 2
+ self.pc = PubnubCrypto2()
+ else:
+ self.python_version = 3
+ self.pc = PubnubCrypto3()
+
if not isinstance(self.uuid, str):
raise AttributeError("pres_uuid must be a string")