Changeset - 632c4f992443
[Not reviewed]
default
0 1 0
Dennis Fink - 10 years ago 2015-07-08 22:23:53

decode early
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
spaceapi/sensors.py
Show inline comments
 
@@ -71,15 +71,15 @@ def set_radiation_value(data):
 

	
 
@sensors_views.route('/set/<key>', methods=['POST'])
 
@httpauth.login_required
 
def set_sensors(key):
 

	
 
    if key in ALLOWED_SENSORS_KEYS and key in active_json['sensors']:
 
        data = request.data
 
        data = request.data.decode('utf-8')
 
        try:
 
            data = json.loads(data.decode('utf-8'))
 
            data = json.loads(data)
 

	
 
            try:
 
                jsonschema.validate(data, ALLOWED_SENSORS_KEYS[key])
 
            except jsonschema.ValidationError:
 
                current_app.logger.info('Validation Error')
 
                return abort(400)
0 comments (0 inline, 0 general)