当前位置: 首页>>代码示例>>Python>>正文


Python Pubnub.time方法代码示例

本文整理汇总了Python中Pubnub.Pubnub.time方法的典型用法代码示例。如果您正苦于以下问题:Python Pubnub.time方法的具体用法?Python Pubnub.time怎么用?Python Pubnub.time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pubnub.Pubnub的用法示例。


在下文中一共展示了Pubnub.time方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: print

# 需要导入模块: from Pubnub import Pubnub [as 别名]
# 或者: from Pubnub.Pubnub import time [as 别名]
    else :
        print( 'FAIL: ' + name )

## -----------------------------------------------------------------------
## Publish Example
## -----------------------------------------------------------------------
publish_success = pubnub.publish({
    'channel' : crazy,
    'message' : crazy
})
test( publish_success[0] == 1, 'Publish First Message Success' )

## -----------------------------------------------------------------------
## History Example
## -----------------------------------------------------------------------
history = pubnub.history({
    'channel' : crazy,
    'limit'   : 1
})
test(
    history[0].encode('utf-8') == crazy,
    'History Message: ' + history[0]
)
test( len(history) == 1, 'History Message Count' )

## -----------------------------------------------------------------------
## PubNub Server Time Example
## -----------------------------------------------------------------------
timestamp = pubnub.time()
test( timestamp > 0, 'PubNub Server Time: ' + str(timestamp) )
开发者ID:Mike-Forrester,项目名称:python,代码行数:32,代码来源:unit-test.py

示例2: test

# 需要导入模块: from Pubnub import Pubnub [as 别名]
# 或者: from Pubnub.Pubnub import time [as 别名]
## ---------------------------------------------------------------------------
## Unit Test Function
## ---------------------------------------------------------------------------
def test( trial, name ) :
    if trial :
        print( 'PASS: ' + name )
    else :
        print( 'FAIL: ' + name )

## -----------------------------------------------------------------------
## Time Example
## -----------------------------------------------------------------------
def time_complete(timestamp):
    print(timestamp)

pubnub.time({ 'callback' : time_complete })

## -----------------------------------------------------------------------
## History Example
## -----------------------------------------------------------------------
def history_complete(messages):
    print(messages)

pubnub.history( {
    'channel'  : crazy,
    'limit'    : 10,
    'callback' : history_complete
})

## -----------------------------------------------------------------------
## Publish Example
开发者ID:Vall3y,项目名称:pubnub-api,代码行数:33,代码来源:unit-test.py

示例3: test

# 需要导入模块: from Pubnub import Pubnub [as 别名]
# 或者: from Pubnub.Pubnub import time [as 别名]
## ---------------------------------------------------------------------------
def test(trial, name):
    if trial:
        print("PASS: " + name)
    else:
        print("FAIL: " + name)


## -----------------------------------------------------------------------
## Time Example
## -----------------------------------------------------------------------
def time_complete(timestamp):
    print(timestamp)


pubnub.time({"callback": time_complete})

## -----------------------------------------------------------------------
## History Example
## -----------------------------------------------------------------------
def history_complete(messages):
    print(messages)


pubnub.history({"channel": crazy, "limit": 10, "callback": history_complete})

## -----------------------------------------------------------------------
## Publish Example
## -----------------------------------------------------------------------
def publish_complete(info):
    print(info)
开发者ID:edgarcaixm,项目名称:pubnub-api,代码行数:33,代码来源:unit-test.py


注:本文中的Pubnub.Pubnub.time方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。