本文整理汇总了Python中neubot.notify.NOTIFIER.needs_publish方法的典型用法代码示例。如果您正苦于以下问题:Python NOTIFIER.needs_publish方法的具体用法?Python NOTIFIER.needs_publish怎么用?Python NOTIFIER.needs_publish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neubot.notify.NOTIFIER
的用法示例。
在下文中一共展示了NOTIFIER.needs_publish方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _api_state
# 需要导入模块: from neubot.notify import NOTIFIER [as 别名]
# 或者: from neubot.notify.NOTIFIER import needs_publish [as 别名]
def _api_state(self, stream, request, query):
dictionary = cgi.parse_qs(query)
t = None
if dictionary.has_key("t"):
t = dictionary["t"][0]
stale = NOTIFIER.needs_publish(STATECHANGE, t)
if not stale:
NOTIFIER.subscribe(STATECHANGE, self._api_state_complete,
(stream, request, query, t), True)
return
self._api_state_complete(STATECHANGE, (stream, request, query, t))
示例2: _api_state
# 需要导入模块: from neubot.notify import NOTIFIER [as 别名]
# 或者: from neubot.notify.NOTIFIER import needs_publish [as 别名]
def _api_state(self, stream, request, query):
''' Implements /api/state URI '''
dictionary = cgi.parse_qs(query)
otime = None
if "t" in dictionary:
otime = dictionary["t"][0]
stale = NOTIFIER.needs_publish(STATECHANGE, otime)
if not stale:
NOTIFIER.subscribe(STATECHANGE, self._api_state_complete,
(stream, request, query, otime), True)
return
self._api_state_complete(STATECHANGE, (stream, request, query, otime))