Skip to content

Commit

Permalink
empty post to ai crashes, fixes schollz#83
Browse files Browse the repository at this point in the history
  • Loading branch information
schollz committed May 7, 2018
1 parent 4f420bc commit b595d41
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/ai/src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ def classify():
t = time.time()

payload = request.get_json()
if payload is None:
return jsonify({'success': False, 'message': 'must provide sensor data'})

if 'sensor_data' not in payload:
return jsonify({'success': False, 'message': 'must provide sensor data'})

Expand Down Expand Up @@ -69,6 +72,8 @@ def classify():
@app.route('/learn', methods=['POST'])
def learn():
payload = request.get_json()
if payload is None:
return jsonify({'success': False, 'message': 'must provide sensor data'})
if 'family' not in payload:
return jsonify({'success': False, 'message': 'must provide family'})
if 'csv_file' not in payload:
Expand Down

0 comments on commit b595d41

Please sign in to comment.