with python3 and flask 1.0.3 I have created this method
@app.route("/robota/api/eye/left", methods=['POST'])
def move_eye():
t = request.json['left']
return 'test'
with JQuery I have created that function
function move_eye(left){
console.log(left);
$.post(url + '/eye/left', left).done(function(leftEye) { showMyPositions(leftEye); });
};
Which causes this output on the browser,
{posYaw: 53, posPitch: 37}
jquery.js:10254 POST http://localhost:8080/robota/api/eye/left 500
and this is returned by flask,
t = request.json['left']
TypeError: 'NoneType' object is not subscriptable
I have mentioed the version as it seems flask changed over time the json handling what would be the correct way to recieve the JQuery posted json on the flask side ?