|
|
@@ -67,10 +67,12 @@ def get_keywords():
|
|
|
def add__keyword():
|
|
|
json = request.get_json()
|
|
|
if 'kw' not in json or 'weight' not in json:
|
|
|
+ print(json)
|
|
|
abort(400)
|
|
|
if not d.add_keyword(json['kw'], json['weight']):
|
|
|
+ print("cant add")
|
|
|
abort(400)
|
|
|
- return jsonify({})
|
|
|
+ return jsonify({'keywords': d.get_keywords_weight_list()})
|
|
|
|
|
|
|
|
|
@app.route(BASEPATH + '/keywords/', methods=['PUT'])
|
|
|
@@ -100,7 +102,7 @@ def update_keyword():
|
|
|
@app.route(BASEPATH + '/keywords', methods=['DELETE'])
|
|
|
def delete_keyword():
|
|
|
json = request.get_json()
|
|
|
- if 'kw' not in json:
|
|
|
+ if json is None or 'kw' not in json:
|
|
|
abort(400)
|
|
|
kw = json['kw']
|
|
|
if not d.delete_keyword(kw):
|