本文整理汇总了Python中Pubnub.Pubnub.unsubscribe方法的典型用法代码示例。如果您正苦于以下问题:Python Pubnub.unsubscribe方法的具体用法?Python Pubnub.unsubscribe怎么用?Python Pubnub.unsubscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pubnub.Pubnub
的用法示例。
在下文中一共展示了Pubnub.unsubscribe方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from Pubnub import Pubnub [as 别名]
# 或者: from Pubnub.Pubnub import unsubscribe [as 别名]
try:
pubnub.subscribe(channels=subchannel, callback=_kill, error=_error) ## Change to callback
while True:
previous_state = current_state
current_state = GPIO.input(sensor)
if current_state != previous_state:
new_state = "HIGH" if current_state else "LOW"
if current_state: # Motion is Detected
lock.acquire()
cam.start_preview() # Comment in future
cam.preview_fullscreen = False
cam.preview_window = (10,10, 320,240)
print('Motion Detected')
for i in range(imgCount):
curTime = (time.strftime("%I:%M:%S")) + ".jpg"
cam.capture(curTime, resize=(320,240))
t = threading.Thread(target=processImage, args = (curTime,))
t.daemon = True
t.start()
time.sleep(frameSleep)
cam.stop_preview()
lock.release()
time.sleep(camSleep)
except KeyboardInterrupt:
cam.stop_preview()
pubnub.unsubscribe(subchannel)
sys.exit(0)
示例2: reconnect
# 需要导入模块: from Pubnub import Pubnub [as 别名]
# 或者: from Pubnub.Pubnub import unsubscribe [as 别名]
def reconnect(message):
print("RECONNECTED")
def disconnect(message):
print("DISCONNECTED")
pubnub.subscribe(channel, callback=callback, error=callback,
connect=connect, reconnect=reconnect, disconnect=disconnect)
dataCollectionInterval = 15
time.sleep(dataCollectionInterval)
pubnub.unsubscribe(channel=channel)
print "Raw data:"
print rawData
chartDataX = []
chartDataY = []
for time, item in enumerate(rawData):
chartDataX.append((time,item[0]))
chartDataY.append((time,item[1]))
print "chart data: "
print chartDataX
print chartDataY