aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevendra2015-06-19 00:52:43 +0530
committerDevendra2015-06-19 00:52:43 +0530
commit74953cb311e46636f9ce4903e41acac9bfc7f6ba (patch)
treef56371901d681cc1704e7ffd901a404facaf13c3
parent589a28dbf9495c3d2d904d3ffd46947278eb0a7b (diff)
parentdf1ed365a2f490b3823fa785818e30c2eecf7dbb (diff)
downloadpubnub-python-74953cb311e46636f9ce4903e41acac9bfc7f6ba.tar.bz2
merging develop
-rw-r--r--README.md2
-rw-r--r--VERSION2
-rw-r--r--common/unit-test-async.py155
-rw-r--r--docs/build/doctrees/environment.picklebin14179 -> 14179 bytes
-rw-r--r--docs/build/html/genindex.html10
-rw-r--r--docs/build/html/index.html10
-rw-r--r--docs/build/html/objects.invbin561 -> 561 bytes
-rw-r--r--docs/build/html/py-modindex.html10
-rw-r--r--docs/build/html/search.html10
-rw-r--r--docs/source/conf.py4
-rw-r--r--pubnub.py (renamed from Pubnub.py)119
-rw-r--r--python-tornado/README.md2
-rw-r--r--python-tornado/examples/audit.py2
-rw-r--r--python-tornado/examples/grant.py2
-rw-r--r--python-tornado/examples/here-now.py2
-rw-r--r--python-tornado/examples/history.py2
-rw-r--r--python-tornado/examples/presence_group.py2
-rw-r--r--python-tornado/examples/publish.py2
-rw-r--r--python-tornado/examples/revoke.py2
-rw-r--r--python-tornado/examples/subscribe.py2
-rw-r--r--python-tornado/examples/subscribe_group.py2
-rw-r--r--python-tornado/migration.md4
-rw-r--r--python-tornado/tests/benchmark.py2
-rw-r--r--python-tornado/tests/delivery.py2
-rwxr-xr-xpython-tornado/tests/subscribe-test.py2
-rw-r--r--python-tornado/tests/test_grant_async.py2
-rw-r--r--python-tornado/tests/test_publish_async.py2
-rw-r--r--python-twisted/README.md2
-rw-r--r--python-twisted/examples/audit.py2
-rw-r--r--python-twisted/examples/echo-client.py2
-rw-r--r--python-twisted/examples/echo-server.py2
-rw-r--r--python-twisted/examples/grant.py2
-rw-r--r--python-twisted/examples/here-now.py2
-rw-r--r--python-twisted/examples/history.py2
-rw-r--r--python-twisted/examples/publish.py2
-rw-r--r--python-twisted/examples/revoke.py2
-rw-r--r--python-twisted/examples/subscribe.py2
-rw-r--r--python-twisted/examples/subscribe_group.py2
-rw-r--r--python-twisted/migration.md4
-rw-r--r--python-twisted/tests/benchmark.py2
-rw-r--r--python-twisted/tests/delivery.py2
-rwxr-xr-xpython-twisted/tests/subscribe-test.py2
-rw-r--r--python-twisted/tests/test_grant_async.py2
-rw-r--r--python-twisted/tests/test_publish_async.py2
-rw-r--r--python-twisted/tests/unit-test-full.py2
-rw-r--r--python/examples/audit.py2
-rw-r--r--python/examples/console.py2
-rw-r--r--python/examples/cr.py2
-rwxr-xr-xpython/examples/dev-console.py2
-rw-r--r--python/examples/grant.py2
-rw-r--r--python/examples/here-now.py2
-rw-r--r--python/examples/history.py2
-rw-r--r--python/examples/presence.py2
-rw-r--r--python/examples/publish.py4
-rw-r--r--python/examples/pubnub-console/pubnub-console2
-rw-r--r--python/examples/revoke.py2
-rw-r--r--python/examples/subscribe.py9
-rw-r--r--python/examples/subscribe_group.py2
-rwxr-xr-xpython/tests/subscribe-test.py2
-rw-r--r--python/tests/test_cg.py2
-rw-r--r--python/tests/test_grant.py2
-rw-r--r--python/tests/test_grant_async.py2
-rw-r--r--python/tests/test_publish_async.py2
-rw-r--r--setup.py4
64 files changed, 120 insertions, 323 deletions
diff --git a/README.md b/README.md
index dfc6988..254ee4b 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
## Installation
```
-pip install pubnub==3.7.1
+pip install pubnub==3.7.2
```
Examples and instructions for the SDK are available in their acompanying README.md, migration.md and examples directories under their specific platform directories:
diff --git a/VERSION b/VERSION
index a76ccff..0b2eb36 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.7.1
+3.7.2
diff --git a/common/unit-test-async.py b/common/unit-test-async.py
deleted file mode 100644
index c4dfb65..0000000
--- a/common/unit-test-async.py
+++ /dev/null
@@ -1,155 +0,0 @@
-## www.pubnub.com - PubNub Real-time push service in the cloud.
-# coding=utf8
-
-## PubNub Real-time Push APIs and Notifications Framework
-## Copyright (c) 2010 Stephen Blum
-## http://www.pubnub.com/
-
-## -----------------------------------
-## PubNub 3.1 Real-time Push Cloud API
-## -----------------------------------
-
-import sys
-import time
-import random
-from Pubnub import Pubnub
-
-publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
-subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
-secret_key = len(sys.argv) > 3 and sys.argv[3] or None
-cipher_key = len(sys.argv) > 4 and sys.argv[4] or None
-ssl_on = len(sys.argv) > 5 and bool(sys.argv[5]) or False
-
-## -----------------------------------------------------------------------
-## Initiat Class
-## -----------------------------------------------------------------------
-pubnub = Pubnub(publish_key, subscribe_key, secret_key, cipher_key, ssl_on)
-ch = 'python-async-test-channel-'
-expect = 0
-done = 0
-failures = 0
-passes = 0
-
-
-def stop():
- global done
- global count
- pubnub.stop()
- print "============================"
- print 'Total\t:\t', failures + passes
- print 'PASS\t:\t', passes
- print 'FAIL\t:\t', failures
- print "============================"
-
-## ---------------------------------------------------------------------------
-## Unit Test Function
-## ---------------------------------------------------------------------------
-
-
-def test(trial, name):
- global failures
- global passes
- global done
- done += 1
- #print trial
- if trial is False:
- print 'FAIL : ', name
- failures += 1
- else:
- print 'PASS : ', name
- passes += 1
- if done == expect:
- stop()
-
-
-def test_publish():
- channel = ch + str(random.random())
-
- def publish_cb(messages):
- test(messages[0] == 1, "Publish Test")
-
- pubnub.publish({
- 'channel': channel,
- 'message': {'one': 'Hello World! --> ɂ顶@#$%^&*()!', 'two': 'hello2'},
- 'callback': publish_cb
- })
-
-
-def test_history():
- channel = ch + str(random.random())
-
- def history_cb(messages):
- test(len(messages) <= 1, "History Test")
- pubnub.history({
- 'channel': channel,
- 'limit': 1,
- 'callback': history_cb
- })
-
-
-def test_subscribe():
- message = "Testing Subscribe " + str(random.random())
- channel = ch + str(random.random())
-
- def subscribe_connect_cb():
- def publish_cb(response):
- test(response[0] == 1,
- 'Publish Test in subscribe Connect Callback')
- pubnub.publish({
- 'channel': channel,
- 'message': message,
- 'callback': publish_cb
- })
-
- def subscribe_cb(response):
- test(response == message,
- 'Subscribe Receive Test in subscribe Callback')
- pubnub.subscribe({
- 'channel': channel,
- 'connect': subscribe_connect_cb,
- 'callback': subscribe_cb
- })
-
-
-def test_here_now():
- channel = ch + str(random.random())
- message = "Testing Subscribe"
-
- def subscribe_connect_cb():
- def here_now_cb(response):
- test(response["occupancy"] > 0, 'Here Now Test')
-
- def publish_cb(response):
- test(response[0] == 1,
- 'Here Now Test: Publish Test in \
- subscribe Connect Callback')
- pubnub.publish({
- 'channel': channel,
- 'message': message,
- 'callback': publish_cb
- })
- time.sleep(5)
- pubnub.here_now({
- 'channel': channel,
- 'callback': here_now_cb
- })
-
- def subscribe_cb(response):
- test(response == message,
- 'Here Now Test: Subscribe Receive Test in subscribe Callback')
- pubnub.subscribe({
- 'channel': channel,
- 'connect': subscribe_connect_cb,
- 'callback': subscribe_cb
- })
-
-expect = 7
-test_publish()
-test_history()
-test_subscribe()
-test_here_now()
-
-
-pubnub.start()
-if failures > 0:
- raise Exception('Fail', failures)
diff --git a/docs/build/doctrees/environment.pickle b/docs/build/doctrees/environment.pickle
index e9cef6b..1294b22 100644
--- a/docs/build/doctrees/environment.pickle
+++ b/docs/build/doctrees/environment.pickle
Binary files differ
diff --git a/docs/build/html/genindex.html b/docs/build/html/genindex.html
index e85fcb8..d812458 100644
--- a/docs/build/html/genindex.html
+++ b/docs/build/html/genindex.html
@@ -7,7 +7,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Index &mdash; PubNub 3.7.1 documentation</title>
+ <title>Index &mdash; PubNub 3.7.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@@ -15,7 +15,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
- VERSION: '3.7.1',
+ VERSION: '3.7.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
- <link rel="top" title="PubNub 3.7.1 documentation" href="index.html" />
+ <link rel="top" title="PubNub 3.7.2 documentation" href="index.html" />
</head>
<body>
<div class="related">
@@ -36,7 +36,7 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
- <li><a href="index.html">PubNub 3.7.1 documentation</a> &raquo;</li>
+ <li><a href="index.html">PubNub 3.7.2 documentation</a> &raquo;</li>
</ul>
</div>
@@ -486,7 +486,7 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
- <li><a href="index.html">PubNub 3.7.1 documentation</a> &raquo;</li>
+ <li><a href="index.html">PubNub 3.7.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
diff --git a/docs/build/html/index.html b/docs/build/html/index.html
index 0ec9d4c..78ea76c 100644
--- a/docs/build/html/index.html
+++ b/docs/build/html/index.html
@@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Welcome to PubNub’s documentation! &mdash; PubNub 3.7.1 documentation</title>
+ <title>Welcome to PubNub’s documentation! &mdash; PubNub 3.7.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
- VERSION: '3.7.1',
+ VERSION: '3.7.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@@ -23,7 +23,7 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
- <link rel="top" title="PubNub 3.7.1 documentation" href="#" />
+ <link rel="top" title="PubNub 3.7.2 documentation" href="#" />
</head>
<body>
<div class="related">
@@ -35,7 +35,7 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
- <li><a href="#">PubNub 3.7.1 documentation</a> &raquo;</li>
+ <li><a href="#">PubNub 3.7.2 documentation</a> &raquo;</li>
</ul>
</div>
@@ -2648,7 +2648,7 @@ Required argument when working with twisted or tornado .</dd>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
- <li><a href="#">PubNub 3.7.1 documentation</a> &raquo;</li>
+ <li><a href="#">PubNub 3.7.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
diff --git a/docs/build/html/objects.inv b/docs/build/html/objects.inv
index 865be47..451dd19 100644
--- a/docs/build/html/objects.inv
+++ b/docs/build/html/objects.inv
Binary files differ
diff --git a/docs/build/html/py-modindex.html b/docs/build/html/py-modindex.html
index 2455529..3460d33 100644
--- a/docs/build/html/py-modindex.html
+++ b/docs/build/html/py-modindex.html
@@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Python Module Index &mdash; PubNub 3.7.1 documentation</title>
+ <title>Python Module Index &mdash; PubNub 3.7.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
- VERSION: '3.7.1',
+ VERSION: '3.7.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@@ -23,7 +23,7 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
- <link rel="top" title="PubNub 3.7.1 documentation" href="index.html" />
+ <link rel="top" title="PubNub 3.7.2 documentation" href="index.html" />
<script type="text/javascript">
@@ -42,7 +42,7 @@
<li class="right" >
<a href="#" title="Python Module Index"
>modules</a> |</li>
- <li><a href="index.html">PubNub 3.7.1 documentation</a> &raquo;</li>
+ <li><a href="index.html">PubNub 3.7.2 documentation</a> &raquo;</li>
</ul>
</div>
@@ -101,7 +101,7 @@
<li class="right" >
<a href="#" title="Python Module Index"
>modules</a> |</li>
- <li><a href="index.html">PubNub 3.7.1 documentation</a> &raquo;</li>
+ <li><a href="index.html">PubNub 3.7.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
diff --git a/docs/build/html/search.html b/docs/build/html/search.html
index a312b62..281f6ca 100644
--- a/docs/build/html/search.html
+++ b/docs/build/html/search.html
@@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Search &mdash; PubNub 3.7.1 documentation</title>
+ <title>Search &mdash; PubNub 3.7.2 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
@@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
- VERSION: '3.7.1',
+ VERSION: '3.7.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@@ -24,7 +24,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/searchtools.js"></script>
- <link rel="top" title="PubNub 3.7.1 documentation" href="index.html" />
+ <link rel="top" title="PubNub 3.7.2 documentation" href="index.html" />
<script type="text/javascript">
jQuery(function() { Search.loadIndex("searchindex.js"); });
</script>
@@ -43,7 +43,7 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
- <li><a href="index.html">PubNub 3.7.1 documentation</a> &raquo;</li>
+ <li><a href="index.html">PubNub 3.7.2 documentation</a> &raquo;</li>
</ul>
</div>
@@ -94,7 +94,7 @@
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
- <li><a href="index.html">PubNub 3.7.1 documentation</a> &raquo;</li>
+ <li><a href="index.html">PubNub 3.7.2 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
diff --git a/docs/source/conf.py b/docs/source/conf.py
index aa36d8e..e961ef0 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -54,9 +54,9 @@ copyright = u'2014, PubNub Inc.'
# built documents.
#
# The short X.Y version.
-version = '3.7.1'
+version = '3.7.2'
# The full version, including alpha/beta/rc tags.
-release = '3.7.1'
+release = '3.7.2'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/Pubnub.py b/pubnub.py
index 1cd2a3f..6fc9f2a 100644
--- a/Pubnub.py
+++ b/pubnub.py
@@ -7,7 +7,7 @@
## http://www.pubnub.com/
## -----------------------------------
-## PubNub 3.7.1 Real-time Push Cloud API
+## PubNub 3.7.2 Real-time Push Cloud API
## -----------------------------------
@@ -25,8 +25,6 @@ from base64 import urlsafe_b64encode
from base64 import encodestring, decodestring
import hmac
from Crypto.Cipher import AES
-from Crypto.Hash import MD5
-
try:
from hashlib import sha256
@@ -54,9 +52,7 @@ except ImportError:
#import urllib
import socket
-import sys
import threading
-from threading import current_thread
try:
import urllib3.HTTPConnection
@@ -152,7 +148,6 @@ except ImportError:
##### Twisted imports and globals #####
try:
- from twisted.web.client import getPage
from twisted.internet import reactor
from twisted.internet.defer import Deferred
from twisted.internet.protocol import Protocol
@@ -161,11 +156,8 @@ try:
from twisted.web.client import HTTPConnectionPool
from twisted.web.http_headers import Headers
from twisted.internet.ssl import ClientContextFactory
- from twisted.internet.task import LoopingCall
import twisted
- from twisted.python.compat import (
- _PY3, unicode, intToBytes, networkString, nativeString)
pnconn_pool = HTTPConnectionPool(reactor, persistent=True)
pnconn_pool.maxPersistentPerHost = 100000
@@ -301,7 +293,7 @@ class PubnubBase(object):
"""
self.origin = origin
- self.version = '3.7.1'
+ self.version = '3.7.2'
self.limit = 1800
self.publish_key = publish_key
self.subscribe_key = subscribe_key
@@ -675,8 +667,9 @@ class PubnubBase(object):
if 'message' in response:
callback_data['message'] = response['message']
-
- callback(callback_data)
+
+ if (callback is not None):
+ callback(callback_data)
else:
if (callback is not None):
callback(response)
@@ -786,7 +779,7 @@ class PubnubBase(object):
"""
return self.subscribe(channel+'-pnpres', callback=callback, error=error, connect=connect, disconnect=disconnect, reconnect=reconnect)
- def presence_group(self, channel_group, callback, error=None):
+ def presence_group(self, channel_group, callback, error=None, connect=None, disconnect=None, reconnect=None):
"""Subscribe to presence events on a channel group.
Only works in async mode
@@ -802,7 +795,7 @@ class PubnubBase(object):
Returns:
None
"""
- return self.subscribe_group(channel_group+'-pnpres', callback=callback)
+ return self.subscribe_group(channel_group+'-pnpres', callback=callback, error=error, connect=connect, disconnect=disconnect, reconnect=reconnect)
def here_now(self, channel, uuids=True, state=False, callback=None, error=None):
"""Get here now data.
@@ -925,6 +918,22 @@ class PubnubBase(object):
[["Pub1","Pub2","Pub3","Pub4","Pub5"],13406746729185766,13406746845892666]
"""
+ def _get_decrypted_history(resp):
+ if resp and resp[1] is not None and self.cipher_key:
+ msgs = resp[0]
+ for i in range(0,len(msgs)):
+ msgs[i] = self.decrypt(msgs[i])
+ return resp
+
+ def _history_callback(resp):
+ if callback is not None:
+ callback(_get_decrypted_history(resp))
+
+ if callback is None:
+ history_cb = None
+ else:
+ history_cb = _history_callback
+
params = dict()
params['count'] = count
@@ -936,7 +945,7 @@ class PubnubBase(object):
params['include_token'] = 'true' if include_token else 'false'
## Get History
- return self._request({'urlcomponents': [
+ return _get_decrypted_history(self._request({'urlcomponents': [
'v2',
'history',
'sub-key',
@@ -944,8 +953,8 @@ class PubnubBase(object):
'channel',
channel,
], 'urlparams': params},
- callback=self._return_wrapped_callback(callback),
- error=self._return_wrapped_callback(error))
+ callback=self._return_wrapped_callback(history_cb),
+ error=self._return_wrapped_callback(error)))
def time(self, callback=None):
"""This function will return a 17 digit precision Unix epoch.
@@ -1609,17 +1618,13 @@ class PubnubCoreAsync(PubnubBase):
connect=connect, disconnect=disconnect, reconnect=reconnect, sync=sync)
def _subscribe(self, channels=None, channel_groups=None, state=None, callback=None, error=None,
- connect=None, disconnect=None, reconnect=None, sync=False):
+ connect=None, disconnect=None, reconnect=None):
with self._tt_lock:
self.last_timetoken = self.timetoken if self.timetoken != 0 \
else self.last_timetoken
self.timetoken = 0
- if sync is True and self.subscribe_sync is not None:
- self.subscribe_sync(args)
- return
-
def _invoke(func, msg=None, channel=None, real_channel=None):
if func is not None:
if msg is not None and channel is not None and real_channel is not None:
@@ -1807,7 +1812,7 @@ class PubnubCoreAsync(PubnubBase):
if ch[1] in self.subscription_groups or ch[1] in self.subscriptions:
try:
chobj = self.subscription_groups[ch[1]]
- except KeyError as k:
+ except KeyError:
chobj = self.subscriptions[ch[1]]
_invoke(chobj['callback'],
self.decrypt(response_list[ch[0]]),
@@ -1961,62 +1966,6 @@ class PubnubCore(PubnubCoreAsync):
self.timetoken = 0
self.accept_encoding = 'gzip'
- def subscribe_sync(self, channel, callback, timetoken=0):
- """
- #**
- #* Subscribe
- #*
- #* This is BLOCKING.
- #* Listen for a message on a channel.
- #*
- #* @param array args with channel and callback.
- #* @return false on fail, array on success.
- #**
-
- ## Subscribe Example
- def receive(message) :
- print(message)
- return True
-
- pubnub.subscribe({
- 'channel' : 'hello_world',
- 'callback' : receive
- })
-
- """
-
- subscribe_key = self.subscribe_key
-
- ## Begin Subscribe
- while True:
- try:
- ## Wait for Message
- response = self._request({"urlcomponents": [
- 'subscribe',
- subscribe_key,
- channel,
- '0',
- str(timetoken)
- ], "urlparams": {"uuid": self.uuid, 'pnsdk' : self.pnsdk}})
-
- messages = response[0]
- timetoken = response[1]
-
- ## If it was a timeout
- if not len(messages):
- continue
-
- ## Run user Callback and Reconnect if user permits.
- for message in messages:
- if not callback(self.decrypt(message)):
- return
-
- except Exception:
- time.sleep(1)
-
- return True
-
-
class HTTPClient:
def __init__(self, pubnub, url, urllib_func=None,
callback=None, error=None, id=None, timeout=5):
@@ -2058,7 +2007,7 @@ class HTTPClient:
self.pubnub.latest_sub_callback['id'] = 0
try:
data = json.loads(data)
- except ValueError as e:
+ except ValueError:
_invoke(self.pubnub.latest_sub_callback['error'],
{'error': 'json decoding error'})
return
@@ -2297,7 +2246,7 @@ class PubnubTwisted(PubnubCoreAsync):
try:
request = agent.request(
'GET', url, Headers(self.headers), None)
- except TypeError as te:
+ except TypeError:
request = agent.request(
'GET', url.encode(), Headers(self.headers), None)
@@ -2324,10 +2273,10 @@ class PubnubTwisted(PubnubCoreAsync):
return None
try:
data = json.loads(data)
- except ValueError as e:
+ except ValueError:
try:
data = json.loads(data.decode("utf-8"))
- except ValueError as e:
+ except ValueError:
_invoke(error, {'error': 'json decode error'})
if 'error' in data and 'status' in data and 'status' != 200:
@@ -2422,10 +2371,10 @@ class PubnubTornado(PubnubCoreAsync):
try:
data = json.loads(body)
- except TypeError as e:
+ except TypeError:
try:
data = json.loads(body.decode("utf-8"))
- except ValueError as ve:
+ except ValueError:
_invoke(error, {'error': 'json decode error'})
if 'error' in data and 'status' in data and 'status' != 200:
diff --git a/python-tornado/README.md b/python-tornado/README.md
index 59e79b7..eaa2fe0 100644
--- a/python-tornado/README.md
+++ b/python-tornado/README.md
@@ -12,7 +12,7 @@ pubnub.start()
#### Import
```
-from Pubnub import PubnubTornado as Pubnub
+from pubnub import PubnubTornado as Pubnub
```
#### Init
diff --git a/python-tornado/examples/audit.py b/python-tornado/examples/audit.py
index 77d189b..3f6af13 100644
--- a/python-tornado/examples/audit.py
+++ b/python-tornado/examples/audit.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTornado as Pubnub
+from pubnub import PubnubTornado as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'pam'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'pam'
diff --git a/python-tornado/examples/grant.py b/python-tornado/examples/grant.py
index daf7434..e2726b9 100644
--- a/python-tornado/examples/grant.py
+++ b/python-tornado/examples/grant.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTornado as Pubnub
+from pubnub import PubnubTornado as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'pam'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'pam'
diff --git a/python-tornado/examples/here-now.py b/python-tornado/examples/here-now.py
index 5c195f1..7018be7 100644
--- a/python-tornado/examples/here-now.py
+++ b/python-tornado/examples/here-now.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTornado as Pubnub
+from pubnub import PubnubTornado as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python-tornado/examples/history.py b/python-tornado/examples/history.py
index daf1c6e..ff85545 100644
--- a/python-tornado/examples/history.py
+++ b/python-tornado/examples/history.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTornado as Pubnub
+from pubnub import PubnubTornado as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python-tornado/examples/presence_group.py b/python-tornado/examples/presence_group.py
index bb89420..38181cf 100644
--- a/python-tornado/examples/presence_group.py
+++ b/python-tornado/examples/presence_group.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTornado as Pubnub
+from pubnub import PubnubTornado as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python-tornado/examples/publish.py b/python-tornado/examples/publish.py
index 04e88fd..997adfa 100644
--- a/python-tornado/examples/publish.py
+++ b/python-tornado/examples/publish.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTornado as Pubnub
+from pubnub import PubnubTornado as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python-tornado/examples/revoke.py b/python-tornado/examples/revoke.py
index 1e4487e..4bdd9c7 100644
--- a/python-tornado/examples/revoke.py
+++ b/python-tornado/examples/revoke.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTornado as Pubnub
+from pubnub import PubnubTornado as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'pam'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'pam'
diff --git a/python-tornado/examples/subscribe.py b/python-tornado/examples/subscribe.py
index 72f0fc1..96c6ebb 100644
--- a/python-tornado/examples/subscribe.py
+++ b/python-tornado/examples/subscribe.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTornado as Pubnub
+from pubnub import PubnubTornado as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python-tornado/examples/subscribe_group.py b/python-tornado/examples/subscribe_group.py
index eddcf8d..394821a 100644
--- a/python-tornado/examples/subscribe_group.py
+++ b/python-tornado/examples/subscribe_group.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTornado as Pubnub
+from pubnub import PubnubTornado as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python-tornado/migration.md b/python-tornado/migration.md
index d5fd8f0..6a1abf3 100644
--- a/python-tornado/migration.md
+++ b/python-tornado/migration.md
@@ -7,10 +7,10 @@
```
# Pre 3.5:
-from Pubnub import Pubnub
+from pubnub import Pubnub
# New in 3.5+
-from Pubnub import PubnubTornado as Pubnub
+from pubnub import PubnubTornado as Pubnub
```
diff --git a/python-tornado/tests/benchmark.py b/python-tornado/tests/benchmark.py
index 748fe3b..6023017 100644
--- a/python-tornado/tests/benchmark.py
+++ b/python-tornado/tests/benchmark.py
@@ -12,7 +12,7 @@
import sys
import datetime
import tornado
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python-tornado/tests/delivery.py b/python-tornado/tests/delivery.py
index 0181403..21486da 100644
--- a/python-tornado/tests/delivery.py
+++ b/python-tornado/tests/delivery.py
@@ -14,7 +14,7 @@ import datetime
import time
import math
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
## -----------------------------------------------------------------------
## Configuration
diff --git a/python-tornado/tests/subscribe-test.py b/python-tornado/tests/subscribe-test.py
index bcbbc7e..7b57415 100755
--- a/python-tornado/tests/subscribe-test.py
+++ b/python-tornado/tests/subscribe-test.py
@@ -11,7 +11,7 @@
import sys
import datetime
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
from functools import partial
from threading import current_thread
import threading
diff --git a/python-tornado/tests/test_grant_async.py b/python-tornado/tests/test_grant_async.py
index b51b275..c03cf08 100644
--- a/python-tornado/tests/test_grant_async.py
+++ b/python-tornado/tests/test_grant_async.py
@@ -1,6 +1,6 @@
-from Pubnub import PubnubTornado as Pubnub
+from pubnub import PubnubTornado as Pubnub
import time
pubnub = Pubnub("demo","demo")
diff --git a/python-tornado/tests/test_publish_async.py b/python-tornado/tests/test_publish_async.py
index 391297d..1f442ed 100644
--- a/python-tornado/tests/test_publish_async.py
+++ b/python-tornado/tests/test_publish_async.py
@@ -1,6 +1,6 @@
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
import time
pubnub = Pubnub("demo","demo")
diff --git a/python-twisted/README.md b/python-twisted/README.md
index c74fb0d..0677eff 100644
--- a/python-twisted/README.md
+++ b/python-twisted/README.md
@@ -12,7 +12,7 @@ pubnub.start()
#### Import
```
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
```
#### Init
diff --git a/python-twisted/examples/audit.py b/python-twisted/examples/audit.py
index b99a8a9..d5cd34b 100644
--- a/python-twisted/examples/audit.py
+++ b/python-twisted/examples/audit.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'pam'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'pam'
diff --git a/python-twisted/examples/echo-client.py b/python-twisted/examples/echo-client.py
index 6f6d1c7..f329d47 100644
--- a/python-twisted/examples/echo-client.py
+++ b/python-twisted/examples/echo-client.py
@@ -8,7 +8,7 @@
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
## Import Libs
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
## Configuration
diff --git a/python-twisted/examples/echo-server.py b/python-twisted/examples/echo-server.py
index 65f9c57..06ee81a 100644
--- a/python-twisted/examples/echo-server.py
+++ b/python-twisted/examples/echo-server.py
@@ -8,7 +8,7 @@
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
## Import Libs
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
## =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
## Configuration
diff --git a/python-twisted/examples/grant.py b/python-twisted/examples/grant.py
index 053c1f9..3d6284f 100644
--- a/python-twisted/examples/grant.py
+++ b/python-twisted/examples/grant.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'pam'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'pam'
diff --git a/python-twisted/examples/here-now.py b/python-twisted/examples/here-now.py
index 38b79f8..acf8cb0 100644
--- a/python-twisted/examples/here-now.py
+++ b/python-twisted/examples/here-now.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python-twisted/examples/history.py b/python-twisted/examples/history.py
index 81974ec..d8c4063 100644
--- a/python-twisted/examples/history.py
+++ b/python-twisted/examples/history.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python-twisted/examples/publish.py b/python-twisted/examples/publish.py
index 13b5357..a687c59 100644
--- a/python-twisted/examples/publish.py
+++ b/python-twisted/examples/publish.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python-twisted/examples/revoke.py b/python-twisted/examples/revoke.py
index fab0497..3b87015 100644
--- a/python-twisted/examples/revoke.py
+++ b/python-twisted/examples/revoke.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'pam'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'pam'
diff --git a/python-twisted/examples/subscribe.py b/python-twisted/examples/subscribe.py
index 9c73439..1704f7c 100644
--- a/python-twisted/examples/subscribe.py
+++ b/python-twisted/examples/subscribe.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python-twisted/examples/subscribe_group.py b/python-twisted/examples/subscribe_group.py
index 67dbac5..2bfd40a 100644
--- a/python-twisted/examples/subscribe_group.py
+++ b/python-twisted/examples/subscribe_group.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import Pubnub
+from pubnub import Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python-twisted/migration.md b/python-twisted/migration.md
index 49de5a9..924fa7c 100644
--- a/python-twisted/migration.md
+++ b/python-twisted/migration.md
@@ -7,10 +7,10 @@
```
# Pre 3.5:
-from Pubnub import Pubnub
+from pubnub import Pubnub
# New in 3.5+
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
```
diff --git a/python-twisted/tests/benchmark.py b/python-twisted/tests/benchmark.py
index b6477c0..1d5f914 100644
--- a/python-twisted/tests/benchmark.py
+++ b/python-twisted/tests/benchmark.py
@@ -12,7 +12,7 @@
import sys
import datetime
from twisted.internet import reactor
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python-twisted/tests/delivery.py b/python-twisted/tests/delivery.py
index 30ce55f..46690f8 100644
--- a/python-twisted/tests/delivery.py
+++ b/python-twisted/tests/delivery.py
@@ -14,7 +14,7 @@ import datetime
import time
import math
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
## -----------------------------------------------------------------------
## Configuration
diff --git a/python-twisted/tests/subscribe-test.py b/python-twisted/tests/subscribe-test.py
index ba74992..2f4c208 100755
--- a/python-twisted/tests/subscribe-test.py
+++ b/python-twisted/tests/subscribe-test.py
@@ -11,7 +11,7 @@
import sys
import datetime
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
from functools import partial
from threading import current_thread
import threading
diff --git a/python-twisted/tests/test_grant_async.py b/python-twisted/tests/test_grant_async.py
index 5b33b11..0f79570 100644
--- a/python-twisted/tests/test_grant_async.py
+++ b/python-twisted/tests/test_grant_async.py
@@ -1,6 +1,6 @@
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
import time
pubnub = Pubnub("demo","demo")
diff --git a/python-twisted/tests/test_publish_async.py b/python-twisted/tests/test_publish_async.py
index 391297d..1f442ed 100644
--- a/python-twisted/tests/test_publish_async.py
+++ b/python-twisted/tests/test_publish_async.py
@@ -1,6 +1,6 @@
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
import time
pubnub = Pubnub("demo","demo")
diff --git a/python-twisted/tests/unit-test-full.py b/python-twisted/tests/unit-test-full.py
index 3aecf12..2335ef6 100644
--- a/python-twisted/tests/unit-test-full.py
+++ b/python-twisted/tests/unit-test-full.py
@@ -18,7 +18,7 @@
## -----------------------------------
import sys
-from Pubnub import PubnubTwisted as Pubnub
+from pubnub import PubnubTwisted as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python/examples/audit.py b/python/examples/audit.py
index ebf31af..c53c2bd 100644
--- a/python/examples/audit.py
+++ b/python/examples/audit.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import Pubnub
+from pubnub import Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'pam'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'pam'
diff --git a/python/examples/console.py b/python/examples/console.py
index bfa4486..a1915ed 100644
--- a/python/examples/console.py
+++ b/python/examples/console.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import Pubnub
+from pubnub import Pubnub
import threading
from datetime import datetime
diff --git a/python/examples/cr.py b/python/examples/cr.py
index c537780..f63e6d2 100644
--- a/python/examples/cr.py
+++ b/python/examples/cr.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import Pubnub
+from pubnub import Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'pam'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'pam'
diff --git a/python/examples/dev-console.py b/python/examples/dev-console.py
index 134d2e7..8527307 100755
--- a/python/examples/dev-console.py
+++ b/python/examples/dev-console.py
@@ -6,7 +6,7 @@
## http://www.pubnub.com/
import sys
-from Pubnub import Pubnub
+from pubnub import Pubnub
from optparse import OptionParser
diff --git a/python/examples/grant.py b/python/examples/grant.py
index af9352e..b0832e4 100644
--- a/python/examples/grant.py
+++ b/python/examples/grant.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import Pubnub
+from pubnub import Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'pam'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'pam'
diff --git a/python/examples/here-now.py b/python/examples/here-now.py
index 9640cc5..4c2dc4c 100644
--- a/python/examples/here-now.py
+++ b/python/examples/here-now.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import Pubnub
+from pubnub import Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python/examples/history.py b/python/examples/history.py
index 603a0f8..5b92828 100644
--- a/python/examples/history.py
+++ b/python/examples/history.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import Pubnub
+from pubnub import Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python/examples/presence.py b/python/examples/presence.py
index ab91321..7d9af3b 100644
--- a/python/examples/presence.py
+++ b/python/examples/presence.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import Pubnub
+from pubnub import Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python/examples/publish.py b/python/examples/publish.py
index 594e7c4..3bc5e8f 100644
--- a/python/examples/publish.py
+++ b/python/examples/publish.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import Pubnub
+from pubnub import Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
@@ -19,7 +19,7 @@ ssl_on = len(sys.argv) > 5 and bool(sys.argv[5]) or False
## Initiate Pubnub State
## -----------------------------------------------------------------------
pubnub = Pubnub(publish_key=publish_key, subscribe_key=subscribe_key,
- secret_key=secret_key, cipher_key=cipher_key, ssl_on=ssl_on)
+ secret_key=secret_key, cipher_key=cipher_key, ssl_on=ssl_on, pooling=False)
channel = 'hello_world'
message = 'Hello World !!!'
diff --git a/python/examples/pubnub-console/pubnub-console b/python/examples/pubnub-console/pubnub-console
index bfa4486..a1915ed 100644
--- a/python/examples/pubnub-console/pubnub-console
+++ b/python/examples/pubnub-console/pubnub-console
@@ -7,7 +7,7 @@
import sys
-from Pubnub import Pubnub
+from pubnub import Pubnub
import threading
from datetime import datetime
diff --git a/python/examples/revoke.py b/python/examples/revoke.py
index 437e5b5..9bee010 100644
--- a/python/examples/revoke.py
+++ b/python/examples/revoke.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import Pubnub
+from pubnub import Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'pam'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'pam'
diff --git a/python/examples/subscribe.py b/python/examples/subscribe.py
index 9b8b223..489c7c1 100644
--- a/python/examples/subscribe.py
+++ b/python/examples/subscribe.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import Pubnub
+from pubnub import Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
@@ -19,7 +19,7 @@ ssl_on = len(sys.argv) > 5 and bool(sys.argv[5]) or False
## Initiate Pubnub State
## -----------------------------------------------------------------------
pubnub = Pubnub(publish_key=publish_key, subscribe_key=subscribe_key,
- secret_key=secret_key, cipher_key=cipher_key, ssl_on=ssl_on)
+ secret_key=secret_key, cipher_key=cipher_key, ssl_on=ssl_on, daemon=True)
channel = 'a'
@@ -45,5 +45,8 @@ def disconnect(message):
print("DISCONNECTED")
-pubnub.subscribe(channel, callback=callback, error=callback,
+pubnub.subscribe(channels=channel, callback=callback, error=callback,
connect=connect, reconnect=reconnect, disconnect=disconnect)
+import time
+while True:
+ time.sleep(10)
diff --git a/python/examples/subscribe_group.py b/python/examples/subscribe_group.py
index ee8e190..c6dcf67 100644
--- a/python/examples/subscribe_group.py
+++ b/python/examples/subscribe_group.py
@@ -7,7 +7,7 @@
import sys
-from Pubnub import Pubnub as Pubnub
+from pubnub import Pubnub as Pubnub
publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo'
subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo'
diff --git a/python/tests/subscribe-test.py b/python/tests/subscribe-test.py
index a1b1826..7a4b723 100755
--- a/python/tests/subscribe-test.py
+++ b/python/tests/subscribe-test.py
@@ -11,7 +11,7 @@
import sys
import datetime
-from Pubnub import PubnubAsync as Pubnub
+from pubnub import PubnubAsync as Pubnub
from functools import partial
from threading import current_thread
import threading
diff --git a/python/tests/test_cg.py b/python/tests/test_cg.py
index a823e44..f4a1080 100644
--- a/python/tests/test_cg.py
+++ b/python/tests/test_cg.py
@@ -1,4 +1,4 @@
-from Pubnub import Pubnub
+from pubnub import Pubnub
import time
import random
diff --git a/python/tests/test_grant.py b/python/tests/test_grant.py
index 9ecafdf..57f0b14 100644
--- a/python/tests/test_grant.py
+++ b/python/tests/test_grant.py
@@ -1,6 +1,6 @@
-from Pubnub import Pubnub
+from pubnub import Pubnub
import time
pubnub = Pubnub("demo","demo")
diff --git a/python/tests/test_grant_async.py b/python/tests/test_grant_async.py
index 4d38a0a..07c8a2c 100644
--- a/python/tests/test_grant_async.py
+++ b/python/tests/test_grant_async.py
@@ -1,6 +1,6 @@
-from Pubnub import Pubnub
+from pubnub import Pubnub
import time
pubnub = Pubnub("demo","demo")
diff --git a/python/tests/test_publish_async.py b/python/tests/test_publish_async.py
index 7270727..cf0811e 100644
--- a/python/tests/test_publish_async.py
+++ b/python/tests/test_publish_async.py
@@ -1,6 +1,6 @@
-from Pubnub import Pubnub
+from pubnub import Pubnub
import time
pubnub = Pubnub("demo","demo")
diff --git a/setup.py b/setup.py
index e8fa6cf..447cb29 100644
--- a/setup.py
+++ b/setup.py
@@ -2,12 +2,12 @@ from setuptools import setup, find_packages
setup(
name='pubnub',
- version='3.7.1',
+ version='3.7.2',
description='PubNub Real-time push service in the cloud',
author='Stephen Blum',
author_email='support@pubnub.com',
url='http://pubnub.com',
- py_modules=['Pubnub'],
+ py_modules=['pubnub'],
license='MIT',
classifiers=(
'Development Status :: 5 - Production/Stable',