A consumer of my REST API says that on occasion I am returning a 400 Bad Request - The request sent by the client was syntactically incorrect. error.>
400 Bad Request
The request sent by the client was syntactically incorrect.
Also, You can use jsonify
from flask import jsonify class SomeView(MethodView): def post(self, *args, **kwargs): if "csv_file" not in request.files: return jsonify({'errors': 'No csv_file key in request.files.'}), 400