From 09cd0c015ae276aa849297a6a976065b2b3f247b Mon Sep 17 00:00:00 2001 From: Devendra Date: Wed, 23 Apr 2014 14:03:13 +0530 Subject: modifying code for pep 8 compliance --- python-tornado/examples/here-now-example.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'python-tornado/examples/here-now-example.py') diff --git a/python-tornado/examples/here-now-example.py b/python-tornado/examples/here-now-example.py index 85e3432..e6e45a3 100644 --- a/python-tornado/examples/here-now-example.py +++ b/python-tornado/examples/here-now-example.py @@ -1,4 +1,4 @@ -## www.pubnub.com - PubNub Real-time push service in the cloud. +## www.pubnub.com - PubNub Real-time push service in the cloud. # coding=utf8 ## PubNub Real-time Push APIs and Notifications Framework @@ -15,28 +15,30 @@ sys.path.append('..') sys.path.append('../../common') from Pubnub import Pubnub -publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo' +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 'demo' -cipher_key = len(sys.argv) > 4 and sys.argv[4] or '' -ssl_on = len(sys.argv) > 5 and bool(sys.argv[5]) or False +secret_key = len(sys.argv) > 3 and sys.argv[3] or 'demo' +cipher_key = len(sys.argv) > 4 and sys.argv[4] or '' +ssl_on = len(sys.argv) > 5 and bool(sys.argv[5]) or False ## ----------------------------------------------------------------------- ## Initiate Pubnub State ## ----------------------------------------------------------------------- -pubnub = Pubnub( publish_key, subscribe_key, secret_key, cipher_key, ssl_on ) -crazy = 'hello_world' +pubnub = Pubnub(publish_key, subscribe_key, secret_key, cipher_key, ssl_on) +crazy = 'hello_world' ## ----------------------------------------------------------------------- ## History Example ## ----------------------------------------------------------------------- + + def here_now_complete(messages): print(messages) pubnub.stop() -pubnub.here_now( { - 'channel' : crazy, - 'callback' : here_now_complete +pubnub.here_now({ + 'channel': crazy, + 'callback': here_now_complete }) ## ----------------------------------------------------------------------- -- cgit v1.2.3 From f7b89bfafae34fa22509c1d1c59d1284ec62c5df Mon Sep 17 00:00:00 2001 From: Devendra Date: Wed, 23 Apr 2014 21:35:06 +0530 Subject: exception handling changes --- python-tornado/examples/here-now-example.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'python-tornado/examples/here-now-example.py') diff --git a/python-tornado/examples/here-now-example.py b/python-tornado/examples/here-now-example.py index e6e45a3..6e69d53 100644 --- a/python-tornado/examples/here-now-example.py +++ b/python-tornado/examples/here-now-example.py @@ -10,7 +10,6 @@ ## ----------------------------------- import sys -import tornado sys.path.append('..') sys.path.append('../../common') from Pubnub import Pubnub @@ -34,12 +33,11 @@ crazy = 'hello_world' def here_now_complete(messages): print(messages) + print(type(messages)) pubnub.stop() -pubnub.here_now({ - 'channel': crazy, - 'callback': here_now_complete -}) +pubnub.here_now( + channel=crazy, callback=here_now_complete, error=here_now_complete) ## ----------------------------------------------------------------------- ## IO Event Loop -- cgit v1.2.3 From 493e29a108255eb3ae3166dc920f40e2f4e5c4c4 Mon Sep 17 00:00:00 2001 From: Devendra Date: Thu, 24 Apr 2014 00:16:57 +0530 Subject: adding single file for all platforms --- python-tornado/examples/here-now-example.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'python-tornado/examples/here-now-example.py') diff --git a/python-tornado/examples/here-now-example.py b/python-tornado/examples/here-now-example.py index 6e69d53..c701daf 100644 --- a/python-tornado/examples/here-now-example.py +++ b/python-tornado/examples/here-now-example.py @@ -10,9 +10,7 @@ ## ----------------------------------- import sys -sys.path.append('..') -sys.path.append('../../common') -from Pubnub import 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' -- cgit v1.2.3 From cf1021b3671fb7537ad7b3a4d577ef0fcace694a Mon Sep 17 00:00:00 2001 From: Devendra Date: Tue, 6 May 2014 16:43:09 +0530 Subject: modifying examples --- python-tornado/examples/here-now-example.py | 43 ----------------------------- 1 file changed, 43 deletions(-) delete mode 100644 python-tornado/examples/here-now-example.py (limited to 'python-tornado/examples/here-now-example.py') diff --git a/python-tornado/examples/here-now-example.py b/python-tornado/examples/here-now-example.py deleted file mode 100644 index c701daf..0000000 --- a/python-tornado/examples/here-now-example.py +++ /dev/null @@ -1,43 +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 -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' -secret_key = len(sys.argv) > 3 and sys.argv[3] or 'demo' -cipher_key = len(sys.argv) > 4 and sys.argv[4] or '' -ssl_on = len(sys.argv) > 5 and bool(sys.argv[5]) or False - -## ----------------------------------------------------------------------- -## Initiate Pubnub State -## ----------------------------------------------------------------------- -pubnub = Pubnub(publish_key, subscribe_key, secret_key, cipher_key, ssl_on) -crazy = 'hello_world' - -## ----------------------------------------------------------------------- -## History Example -## ----------------------------------------------------------------------- - - -def here_now_complete(messages): - print(messages) - print(type(messages)) - pubnub.stop() - -pubnub.here_now( - channel=crazy, callback=here_now_complete, error=here_now_complete) - -## ----------------------------------------------------------------------- -## IO Event Loop -## ----------------------------------------------------------------------- -pubnub.start() -- cgit v1.2.3