From 756b87fd6fb0809605dcc3b35df20a115a9e3ca5 Mon Sep 17 00:00:00 2001 From: Devendra Date: Wed, 26 Nov 2014 19:19:56 +0530 Subject: make Jay's azure fix an option --- Pubnub.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'Pubnub.py') diff --git a/Pubnub.py b/Pubnub.py index 83d243e..9d69fa0 100644 --- a/Pubnub.py +++ b/Pubnub.py @@ -1483,8 +1483,11 @@ class PubnubHTTPAdapter(HTTPAdapter): super(PubnubHTTPAdapter, self).init_poolmanager(*args, **kwargs) s = requests.Session() -s.mount('http://', PubnubHTTPAdapter(max_retries=1)) -s.mount('https://', PubnubHTTPAdapter(max_retries=1)) +#s.mount('http://', PubnubHTTPAdapter(max_retries=1)) +#s.mount('https://', PubnubHTTPAdapter(max_retries=1)) +#s.mount('http://pubsub.pubnub.com', HTTPAdapter(max_retries=1)) +#s.mount('https://pubsub.pubnub.com', HTTPAdapter(max_retries=1)) + def _requests_request(url, timeout=5): try: @@ -1526,7 +1529,8 @@ class Pubnub(PubnubCore): uuid=None, pooling=True, daemon=False, - pres_uuid=None + pres_uuid=None, + azure=False ): super(Pubnub, self).__init__( publish_key=publish_key, @@ -1553,6 +1557,13 @@ class Pubnub(PubnubCore): self.latest_sub_callback = {'id': None, 'callback': None} self.pnsdk = 'PubNub-Python' + '/' + self.version self.daemon = daemon + + if azure is False: + s.mount('http://pubsub.pubnub.com', HTTPAdapter(max_retries=1)) + s.mount('https://pubsub.pubnub.com', HTTPAdapter(max_retries=1)) + else: + s.mount('http://', PubnubHTTPAdapter(max_retries=1)) + s.mount('https://', PubnubHTTPAdapter(max_retries=1)) def timeout(self, interval, func): def cb(): -- cgit v1.2.3