Python Forum

Full Version: Server Error with parse_args() using Flask
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to develop an api using flask but i'm having a server error in post request, i use this simple code
parserTest = reqparse.RequestParser()
parserTest.add_argument('uid')

class TestPost(Resource):
    def get(self, uid):
        return {'success': f'ok {uid}'} # It works

    def post(self):
        parseTest = parserTest.parse_args()
        return {'warn': f'Parse: {parseTest}'}

api.add_resource(TestPost, '/test')
I tried using this curl requests:
curl -d "uid=asd" -X POST localhost:5000/test
Error:
{"message": "The browser (or proxy) sent a request that this server could not understand."}
curl -F "uid=asd" -X POST localhost:5000/test
Error:
{"message": "The browser (or proxy) sent a request that this server could not understand."}