Python Forum
Server Error with parse_args() using Flask
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Server Error with parse_args() using Flask
#1
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."}
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  500 Internal Server error trying to run external Python script via HTML ppowell777 3 374 May-07-2025, 05:04 PM
Last Post: Larz60+
  Flask web app MySQL runtime error TheTiger 8 6,492 Dec-04-2024, 03:18 AM
Last Post: TheTiger
  [split] flask 500 internal server error DarthTensor 3 5,367 Nov-11-2021, 06:10 AM
Last Post: DarthTensor
  Error updating one to many relationship in Flask/ SQLAlchemy atindra 0 4,115 Apr-15-2021, 10:29 PM
Last Post: atindra
Question Flask, Self-hosted deployment, which server ? SpongeB0B 1 4,201 Apr-11-2021, 11:29 AM
Last Post: snippsat
  TemplateNotFound error with flask Veztar 4 25,046 Aug-28-2020, 07:02 AM
Last Post: Veztar
  Running flask run produces error. Charles1 1 4,938 Oct-04-2019, 10:38 PM
Last Post: snippsat
  [Flask] html error 405 SheeppOSU 0 2,961 Jun-08-2019, 04:42 PM
Last Post: SheeppOSU
  [flask] mail.send giving error SheeppOSU 2 3,784 May-31-2019, 09:31 PM
Last Post: SheeppOSU
  About Error (Flask) bescf 1 3,293 Mar-20-2019, 08:18 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020