aboutsummaryrefslogtreecommitdiffstats
path: root/python/examples/history.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/examples/history.py')
-rw-r--r--python/examples/history.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/python/examples/history.py b/python/examples/history.py
index 603a0f8..19593e1 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'
@@ -33,3 +33,15 @@ def callback(message):
print(message)
pubnub.history(channel, count=2, callback=callback, error=callback)
+
+# Synchronous usage
+
+print pubnub.history(channel, count=2, include_token=True)
+
+# Asynchronous usage
+
+
+def callback(message):
+ print(message)
+
+pubnub.history(channel, count=2, include_token=True, callback=callback, error=callback)