Пример #1
0
def pull_motion_event(queuename):
    # pull motion events from redis and dispatch a signal 
   
    r = redis.StrictRedis(host=settings.MOTION_REDIS_SERVER, port=6379, db=0)
    s = r.lpop(queuename)
    if s:
        from motioncontrol.signals import motion_event
        motion_event.send(__name__,data=json.loads(s.decode('utf8')))

    Timer(30,pull_motion_event,args=[settings.MOTION_REDIS_CHANNEL,]).start()
Пример #2
0
def webhook(request):
    from motioncontrol.signals import motion_event
    motion_event.send(__name__,data=json.loads(request.body.decode('utf8')))
    
    return HttpResponse('ok')