Exemplo n.º 1
0
def post_keyboard():
    json = request.get_json() or specify("keyboard color")
    color = json.get("color") or specify("keyboard color")
    keyboard = Keyboard(color=color)
    if keyboard.exists:
        abort(401, "A {} keyboard is already registered.".format(color))
    keyboard.save()
    return jsonify(keyboard._data)
Exemplo n.º 2
0
def post_keyboard_key(color):
    json = request.get_json() or specify("key name")
    name = json.get("name") or specify("key name")
    add_key.spawn(name=name, keyboard=color)
    Key.update_metrics(name=name, keyboard=color)
    return jsonify(name=name, keyboard=color)