本文整理汇总了Python中Pubnub.Pubnub.audit方法的典型用法代码示例。如果您正苦于以下问题:Python Pubnub.audit方法的具体用法?Python Pubnub.audit怎么用?Python Pubnub.audit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pubnub.Pubnub
的用法示例。
在下文中一共展示了Pubnub.audit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: len
# 需要导入模块: from Pubnub import Pubnub [as 别名]
# 或者: from Pubnub.Pubnub import audit [as 别名]
## http://www.pubnub.com/
import sys
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'
secret_key = len(sys.argv) > 3 and sys.argv[3] or 'pam'
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=publish_key, subscribe_key=subscribe_key,
secret_key=secret_key, cipher_key=cipher_key, ssl_on=ssl_on)
channel = 'hello_world'
authkey = "abcd"
# Synchronous usage
print pubnub.audit(channel, authkey)
# Asynchronous usage
def callback(message):
print(message)
pubnub.audit(channel, authkey, callback=callback, error=callback)
示例2: callback
# 需要导入模块: from Pubnub import Pubnub [as 别名]
# 或者: from Pubnub.Pubnub import audit [as 别名]
publish_key=publish_key,
subscribe_key=subscribe_key,
secret_key=secret_key,
cipher_key=cipher_key,
ssl_on=ssl_on,
auth_key="abcd",
)
channel = "hello_world"
def callback(message):
print (message)
print pubnub.revoke(channel_group="dev:abcd", auth_key="abcd")
print pubnub.audit(channel_group="dev:abcd")
print pubnub.grant(channel_group="dev:abcd", read=True, write=True, manage=True, auth_key="abcd")
print pubnub.channel_group_list_namespaces()
print pubnub.channel_group_list_groups(namespace="aaa")
print pubnub.channel_group_list_groups(namespace="foo")
print pubnub.channel_group_list_channels(channel_group="dev:abcd")
print pubnub.channel_group_add_channel(channel_group="dev:abcd", channel="hi")
print pubnub.channel_group_list_channels(channel_group="dev:abcd")
print pubnub.channel_group_remove_channel(channel_group="dev:abcd", channel="hi")
print pubnub.channel_group_list_channels(channel_group="dev:abcd")
pubnub.revoke(channel_group="dev:abcd", auth_key="abcd", callback=callback, error=callback)
pubnub.audit(channel_group="dev:abcd", callback=callback, error=callback)
pubnub.grant(
channel_group="dev:abcd", read=True, write=True, manage=True, auth_key="abcd", callback=callback, error=callback