diff options
| author | Devendra | 2014-06-17 02:43:16 +0530 | 
|---|---|---|
| committer | Devendra | 2014-06-17 02:43:16 +0530 | 
| commit | c731ae584de53da55ed799f8fd59bff10b9b9b72 (patch) | |
| tree | 9ab66fdafaf833367cb860f6c808c6801453746b | |
| parent | 05dbe7714645c65bce4a73ec11d8d424f5fae296 (diff) | |
| download | pubnub-python-c731ae584de53da55ed799f8fd59bff10b9b9b72.tar.bz2 | |
readme changes
| -rw-r--r-- | python-tornado/README | 78 | ||||
| -rw-r--r-- | python-tornado/README.md | 61 | ||||
| -rw-r--r-- | python-tornado/migration.md | 164 | ||||
| -rw-r--r-- | python-twisted/README | 78 | ||||
| -rw-r--r-- | python-twisted/README.md | 61 | ||||
| -rw-r--r-- | python-twisted/migration.md | 164 | ||||
| -rw-r--r-- | python/README.md | 48 | ||||
| -rw-r--r-- | python/migration.md | 164 | 
8 files changed, 614 insertions, 204 deletions
| diff --git a/python-tornado/README b/python-tornado/README deleted file mode 100644 index e046c6b..0000000 --- a/python-tornado/README +++ /dev/null @@ -1,78 +0,0 @@ -## --------------------------------------------------- -## -## YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API. -## http://www.pubnub.com/account -## -## ---------------------------------------------------- - -## ---------------------------------------------------- -## PubNub 3.5.0 Real-time Cloud Push API - PYTHON TORNADO -## ---------------------------------------------------- -## -## www.pubnub.com - PubNub Real-time Push Service in the Cloud.  -## http://github.com/pubnub/pubnub-api/tree/master/python-tornado/ -## -## PubNub is a Massively Scalable Real-time Service for Web and Mobile Games. -## This is a cloud-based service for broadcasting Real-time messages -## to thousands of web and mobile clients simultaneously. - - -from Pubnub import PubnubTornado as Pubnub - -## --------------- -## Python Push API -## --------------- -pubnub = Pubnub(publish_key="demo", subscribe_key="demo", ssl_on=False) - -## ----------------------------------------------------------------------- -## IO Event Loop -## ----------------------------------------------------------------------- -## VERY IMPORTANT TO ADD THIS LINE AT THE VERY BOTTOM! -## -## pubnub.start() ## IMPORTANT! -## - -## ----------------------------------------------------------------------- -## Subscribe Example -## ----------------------------------------------------------------------- - -channel = 'hello_world' - -def callback(message, channel): -    print(message) - - -def error(message): -    print("ERROR : " + str(message)) - - -def connect(message): -    print("CONNECTED") - - -def reconnect(message): -    print("RECONNECTED") - - -def disconnect(message): -    print("DISCONNECTED") - - -pubnub.subscribe(channel, callback=callback, error=callback, -                 connect=connect, reconnect=reconnect, disconnect=disconnect) - - -## ----------------------------------------------------------------------- -## History Example -## ----------------------------------------------------------------------- -def callback(message): -    print(message) - -pubnub.history(channel, count=2, callback=callback, error=callback) - - - -## ----------------------------------------------------------------------- -## IO Event Loop -## ----------------------------------------------------------------------- -pubnub.start() diff --git a/python-tornado/README.md b/python-tornado/README.md new file mode 100644 index 0000000..1d210f9 --- /dev/null +++ b/python-tornado/README.md @@ -0,0 +1,61 @@ +## PubNub 3.5.0 Web Data Push Cloud-hosted API - PYTHON TORNADO +#### www.pubnub.com - PubNub Web Data Push Service in the Cloud.  +#### http://github.com/pubnub/python + +#### Import +``` +from Pubnub import PubnubTornado as Pubnub +``` + +#### Init +pubnub = Pubnub(publish_key="demo", subscribe_key="demo", ssl_on=False) + + +#### IO Event Loop +##### VERY IMPORTANT TO ADD THIS LINE AT THE VERY BOTTOM! + +``` +pubnub.start() +``` + +#### Subscribe Example +``` +channel = 'hello_world' + +def callback(message, channel): +    print(message) + + +def error(message): +    print("ERROR : " + str(message)) + + +def connect(message): +    print("CONNECTED") + + +def reconnect(message): +    print("RECONNECTED") + + +def disconnect(message): +    print("DISCONNECTED") + + +pubnub.subscribe(channel, callback=callback, error=callback, +                 connect=connect, reconnect=reconnect, disconnect=disconnect) +``` + +#### History Example +``` +def callback(message): +    print(message) + +pubnub.history(channel, count=2, callback=callback, error=callback) +``` + + +#### IO Event Loop start +``` +pubnub.start() +```
\ No newline at end of file diff --git a/python-tornado/migration.md b/python-tornado/migration.md new file mode 100644 index 0000000..10d03ae --- /dev/null +++ b/python-tornado/migration.md @@ -0,0 +1,164 @@ +## PubNub 3.5.0 Web Data Push Cloud-hosted API - PYTHON +#### www.pubnub.com - PubNub Web Data Push Service in the Cloud.  +#### http://github.com/pubnub/python + + +#### Init + + + +``` + +# Pre 3.5: +# + +# New in 3.5+ +pubnub = Pubnub(publish_key="demo", subscribe_key="demo", ssl_on=False) + +``` + +#### PUBLISH + +``` +channel = 'hello_world' +message = 'Hello World !!!' + +# Pre 3.5: +# + +# New in 3.5+ + +# Synchronous usage +print pubnub.publish(channel='hello_world', message='Hello World !!!') + +# Asynchronous usage + +def callback(message): +    print(message) + +pubnub.publish(channel, message, callback=callback, error=callback) + +``` + + +#### SUBSCRIBE +Pre 3.5.x, subscribe was blocking and would only be terminated via a false return from the callback. In our latest version of the SDK, subscribe is asyncronous, and because of this, usage is a bit different, but the experience is more like our other async SDKs. + +``` + +# Listen for Messages + +channel = 'hello_world' + +# Pre 3.5: +# + +# New in 3.5+ + +def callback(message, channel): +    print(message) + + +def error(message): +    print("ERROR : " + str(message)) + + +def connect(message): +    print("CONNECTED") + + +def reconnect(message): +    print("RECONNECTED") + + +def disconnect(message): +    print("DISCONNECTED") + + +pubnub.subscribe(channel, callback=callback, error=callback, +                 connect=connect, reconnect=reconnect, disconnect=disconnect) +``` + +#### Unsubscribe +Once subscribed, you can easily, gracefully, unsubscribe: + +``` +# Pre 3.5: +# + +# New in 3.5+ + +Unsub example +``` + +#### PRESENCE + +``` + +# Pre 3.5: +# + +# New in 3.5+ + +# Listen for Presence Event Messages + +channel = 'hello_world' + +def callback(message, channel): +    print(message) + + +def error(message): +    print("ERROR : " + str(message)) + + + +pubnub.presence(channel, callback=callback, error=callback) +``` + +#### HERE_NOW + +``` + +# Pre 3.5: +# + +# New in 3.5+ + +# Get info on who is here right now! + +channel = 'hello_world' + +# Synchronous usage +print pubnub.here_now(channel) + + +# Asynchronous usage + +def callback(message): +    print(message) + +pubnub.here_now(channel, callback=callback, error=callback) +``` + +#### HISTORY + +``` + +# Pre 3.5: +# + +# New in 3.5+ + +# Synchronous usage + +print pubnub.history(channel, count=2) + +# Asynchronous usage + + +def callback(message): +    print(message) + +pubnub.history(channel, count=2, callback=callback, error=callback) +``` diff --git a/python-twisted/README b/python-twisted/README deleted file mode 100644 index 402fb34..0000000 --- a/python-twisted/README +++ /dev/null @@ -1,78 +0,0 @@ -## --------------------------------------------------- -## -## YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API. -## http://www.pubnub.com/account -## -## ---------------------------------------------------- - -## ---------------------------------------------------- -## PubNub 3.1 Real-time Cloud Push API - PYTHON TWISTED -## ---------------------------------------------------- -## -## www.pubnub.com - PubNub Real-time Push Service in the Cloud.  -## http://github.com/pubnub/pubnub-api/tree/master/python-twisted/ -## -## PubNub is a Massively Scalable Real-time Service for Web and Mobile Games. -## This is a cloud-based service for broadcasting Real-time messages -## to thousands of web and mobile clients simultaneously. - - -from Pubnub import PubnubTwisted as Pubnub - -## --------------- -## Python Push API -## --------------- -pubnub = Pubnub(publish_key="demo", subscribe_key="demo", ssl_on=False) - -## ----------------------------------------------------------------------- -## IO Event Loop -## ----------------------------------------------------------------------- -## VERY IMPORTANT TO ADD THIS LINE AT THE VERY BOTTOM! -## -## pubnub.start() ## IMPORTANT! -## - -## ----------------------------------------------------------------------- -## Subscribe Example -## ----------------------------------------------------------------------- - -channel = 'hello_world' - -def callback(message, channel): -    print(message) - - -def error(message): -    print("ERROR : " + str(message)) - - -def connect(message): -    print("CONNECTED") - - -def reconnect(message): -    print("RECONNECTED") - - -def disconnect(message): -    print("DISCONNECTED") - - -pubnub.subscribe(channel, callback=callback, error=callback, -                 connect=connect, reconnect=reconnect, disconnect=disconnect) - - -## ----------------------------------------------------------------------- -## History Example -## ----------------------------------------------------------------------- -def callback(message): -    print(message) - -pubnub.history(channel, count=2, callback=callback, error=callback) - - - -## ----------------------------------------------------------------------- -## IO Event Loop -## ----------------------------------------------------------------------- -pubnub.start() diff --git a/python-twisted/README.md b/python-twisted/README.md new file mode 100644 index 0000000..47045f5 --- /dev/null +++ b/python-twisted/README.md @@ -0,0 +1,61 @@ +## PubNub 3.5.0 Web Data Push Cloud-hosted API - PYTHON TWISTED +#### www.pubnub.com - PubNub Web Data Push Service in the Cloud.  +#### http://github.com/pubnub/python + +#### Import +``` +from Pubnub import PubnubTwisted as Pubnub +``` + +#### Init +pubnub = Pubnub(publish_key="demo", subscribe_key="demo", ssl_on=False) + + +#### IO Event Loop +##### VERY IMPORTANT TO ADD THIS LINE AT THE VERY BOTTOM! + +``` +pubnub.start() +``` + +#### Subscribe Example +``` +channel = 'hello_world' + +def callback(message, channel): +    print(message) + + +def error(message): +    print("ERROR : " + str(message)) + + +def connect(message): +    print("CONNECTED") + + +def reconnect(message): +    print("RECONNECTED") + + +def disconnect(message): +    print("DISCONNECTED") + + +pubnub.subscribe(channel, callback=callback, error=callback, +                 connect=connect, reconnect=reconnect, disconnect=disconnect) +``` + +#### History Example +``` +def callback(message): +    print(message) + +pubnub.history(channel, count=2, callback=callback, error=callback) +``` + + +#### IO Event Loop start +``` +pubnub.start() +```
\ No newline at end of file diff --git a/python-twisted/migration.md b/python-twisted/migration.md new file mode 100644 index 0000000..10d03ae --- /dev/null +++ b/python-twisted/migration.md @@ -0,0 +1,164 @@ +## PubNub 3.5.0 Web Data Push Cloud-hosted API - PYTHON +#### www.pubnub.com - PubNub Web Data Push Service in the Cloud.  +#### http://github.com/pubnub/python + + +#### Init + + + +``` + +# Pre 3.5: +# + +# New in 3.5+ +pubnub = Pubnub(publish_key="demo", subscribe_key="demo", ssl_on=False) + +``` + +#### PUBLISH + +``` +channel = 'hello_world' +message = 'Hello World !!!' + +# Pre 3.5: +# + +# New in 3.5+ + +# Synchronous usage +print pubnub.publish(channel='hello_world', message='Hello World !!!') + +# Asynchronous usage + +def callback(message): +    print(message) + +pubnub.publish(channel, message, callback=callback, error=callback) + +``` + + +#### SUBSCRIBE +Pre 3.5.x, subscribe was blocking and would only be terminated via a false return from the callback. In our latest version of the SDK, subscribe is asyncronous, and because of this, usage is a bit different, but the experience is more like our other async SDKs. + +``` + +# Listen for Messages + +channel = 'hello_world' + +# Pre 3.5: +# + +# New in 3.5+ + +def callback(message, channel): +    print(message) + + +def error(message): +    print("ERROR : " + str(message)) + + +def connect(message): +    print("CONNECTED") + + +def reconnect(message): +    print("RECONNECTED") + + +def disconnect(message): +    print("DISCONNECTED") + + +pubnub.subscribe(channel, callback=callback, error=callback, +                 connect=connect, reconnect=reconnect, disconnect=disconnect) +``` + +#### Unsubscribe +Once subscribed, you can easily, gracefully, unsubscribe: + +``` +# Pre 3.5: +# + +# New in 3.5+ + +Unsub example +``` + +#### PRESENCE + +``` + +# Pre 3.5: +# + +# New in 3.5+ + +# Listen for Presence Event Messages + +channel = 'hello_world' + +def callback(message, channel): +    print(message) + + +def error(message): +    print("ERROR : " + str(message)) + + + +pubnub.presence(channel, callback=callback, error=callback) +``` + +#### HERE_NOW + +``` + +# Pre 3.5: +# + +# New in 3.5+ + +# Get info on who is here right now! + +channel = 'hello_world' + +# Synchronous usage +print pubnub.here_now(channel) + + +# Asynchronous usage + +def callback(message): +    print(message) + +pubnub.here_now(channel, callback=callback, error=callback) +``` + +#### HISTORY + +``` + +# Pre 3.5: +# + +# New in 3.5+ + +# Synchronous usage + +print pubnub.history(channel, count=2) + +# Asynchronous usage + + +def callback(message): +    print(message) + +pubnub.history(channel, count=2, callback=callback, error=callback) +``` diff --git a/python/README.md b/python/README.md index 10d03ae..14d767f 100644 --- a/python/README.md +++ b/python/README.md @@ -5,14 +5,7 @@  #### Init - -  ``` - -# Pre 3.5: -# - -# New in 3.5+  pubnub = Pubnub(publish_key="demo", subscribe_key="demo", ssl_on=False)  ``` @@ -23,11 +16,6 @@ pubnub = Pubnub(publish_key="demo", subscribe_key="demo", ssl_on=False)  channel = 'hello_world'  message = 'Hello World !!!' -# Pre 3.5: -# - -# New in 3.5+ -  # Synchronous usage  print pubnub.publish(channel='hello_world', message='Hello World !!!') @@ -42,19 +30,12 @@ pubnub.publish(channel, message, callback=callback, error=callback)  #### SUBSCRIBE -Pre 3.5.x, subscribe was blocking and would only be terminated via a false return from the callback. In our latest version of the SDK, subscribe is asyncronous, and because of this, usage is a bit different, but the experience is more like our other async SDKs.  ``` -  # Listen for Messages  channel = 'hello_world' -# Pre 3.5: -# - -# New in 3.5+ -  def callback(message, channel):      print(message) @@ -79,27 +60,10 @@ pubnub.subscribe(channel, callback=callback, error=callback,                   connect=connect, reconnect=reconnect, disconnect=disconnect)  ``` -#### Unsubscribe -Once subscribed, you can easily, gracefully, unsubscribe: - -``` -# Pre 3.5: -# - -# New in 3.5+ - -Unsub example -```  #### PRESENCE  ``` - -# Pre 3.5: -# - -# New in 3.5+ -  # Listen for Presence Event Messages  channel = 'hello_world' @@ -119,12 +83,6 @@ pubnub.presence(channel, callback=callback, error=callback)  #### HERE_NOW  ``` - -# Pre 3.5: -# - -# New in 3.5+ -  # Get info on who is here right now!  channel = 'hello_world' @@ -144,12 +102,6 @@ pubnub.here_now(channel, callback=callback, error=callback)  #### HISTORY  ``` - -# Pre 3.5: -# - -# New in 3.5+ -  # Synchronous usage  print pubnub.history(channel, count=2) diff --git a/python/migration.md b/python/migration.md new file mode 100644 index 0000000..10d03ae --- /dev/null +++ b/python/migration.md @@ -0,0 +1,164 @@ +## PubNub 3.5.0 Web Data Push Cloud-hosted API - PYTHON +#### www.pubnub.com - PubNub Web Data Push Service in the Cloud.  +#### http://github.com/pubnub/python + + +#### Init + + + +``` + +# Pre 3.5: +# + +# New in 3.5+ +pubnub = Pubnub(publish_key="demo", subscribe_key="demo", ssl_on=False) + +``` + +#### PUBLISH + +``` +channel = 'hello_world' +message = 'Hello World !!!' + +# Pre 3.5: +# + +# New in 3.5+ + +# Synchronous usage +print pubnub.publish(channel='hello_world', message='Hello World !!!') + +# Asynchronous usage + +def callback(message): +    print(message) + +pubnub.publish(channel, message, callback=callback, error=callback) + +``` + + +#### SUBSCRIBE +Pre 3.5.x, subscribe was blocking and would only be terminated via a false return from the callback. In our latest version of the SDK, subscribe is asyncronous, and because of this, usage is a bit different, but the experience is more like our other async SDKs. + +``` + +# Listen for Messages + +channel = 'hello_world' + +# Pre 3.5: +# + +# New in 3.5+ + +def callback(message, channel): +    print(message) + + +def error(message): +    print("ERROR : " + str(message)) + + +def connect(message): +    print("CONNECTED") + + +def reconnect(message): +    print("RECONNECTED") + + +def disconnect(message): +    print("DISCONNECTED") + + +pubnub.subscribe(channel, callback=callback, error=callback, +                 connect=connect, reconnect=reconnect, disconnect=disconnect) +``` + +#### Unsubscribe +Once subscribed, you can easily, gracefully, unsubscribe: + +``` +# Pre 3.5: +# + +# New in 3.5+ + +Unsub example +``` + +#### PRESENCE + +``` + +# Pre 3.5: +# + +# New in 3.5+ + +# Listen for Presence Event Messages + +channel = 'hello_world' + +def callback(message, channel): +    print(message) + + +def error(message): +    print("ERROR : " + str(message)) + + + +pubnub.presence(channel, callback=callback, error=callback) +``` + +#### HERE_NOW + +``` + +# Pre 3.5: +# + +# New in 3.5+ + +# Get info on who is here right now! + +channel = 'hello_world' + +# Synchronous usage +print pubnub.here_now(channel) + + +# Asynchronous usage + +def callback(message): +    print(message) + +pubnub.here_now(channel, callback=callback, error=callback) +``` + +#### HISTORY + +``` + +# Pre 3.5: +# + +# New in 3.5+ + +# Synchronous usage + +print pubnub.history(channel, count=2) + +# Asynchronous usage + + +def callback(message): +    print(message) + +pubnub.history(channel, count=2, callback=callback, error=callback) +``` | 
