Exemplo n.º 1
0
def shutdown():
    ## Authorization
    # authorize(request.headers, 'server', 'none')

    stopDevice("webcam")
    shutdown_server()
    return "Server shutting down..."
Exemplo n.º 2
0
def device_action(deviceType):
    ## Authorization
    authorize(request.headers, "device", deviceType)

    data = json.loads(request.data)
    action = data["action"]

    if action == "OFF":
        stopDevice(deviceType)
    elif action == "ON":
        startDevice(deviceType)
    else:
        return make_ws_response({"error": "Invalid Action"}, 1)
    return make_ws_response(data, 0)