@mod.route('/api/v1/tokens/', methods=['POST'])
@api_auth()
def add_token():
    data = request.get_json(force=True)
    if data is None or 'token' not in data:
        return jsonify(status="error", error="Bad request"), 400

    if 'description' not in data:
        data.update(description="no description")
    g.db.execute('insert into api_tokens(description, token) values(?, ?)', [data['description'], data['token']])
    g.db.commit()
    return jsonify(status="ok"), 200
dataset/ETHPy150Open claudyus/LXC-Web-Panel/lwp/views/api.py/add_token/original