Fixed bad request error due to request.args['safe'] modified it to request.form['safe']