add error manazge parse chaine

This commit is contained in:
vincent 2019-04-25 17:49:21 +02:00
parent 98862ad0eb
commit 2291fb2dfa
2 changed files with 6 additions and 2 deletions

View File

@ -44,6 +44,7 @@ class JSONfile:
self.data=liste_chaine self.data=liste_chaine
with open(self.datafilepath, 'w', encoding='utf-8') as f: with open(self.datafilepath, 'w', encoding='utf-8') as f:
json.dump(liste_chaine, f, indent=4) json.dump(liste_chaine, f, indent=4)
return "ok"
def __repr__(self): def __repr__(self):
return str(self.data) return str(self.data)

View File

@ -19,8 +19,11 @@ def get_chaine(num):
@app.route('/api/v1/chaine/', methods=['put']) @app.route('/api/v1/chaine/', methods=['put'])
def update_list(): def update_list():
data.parsechaine() status="data.parsechaine()"
if(status=='ok'):
return jsonify("OK") return jsonify("OK")
else:
return make_response('Error during Chaine Update',500)
@app.route('/api/v1/chaine/<num>/emission', methods=['GET']) @app.route('/api/v1/chaine/<num>/emission', methods=['GET'])
def get_emmission(num): def get_emmission(num):