本文整理匯總了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))