Search code examples
pythonflaskflask-restplus

Flask-RESTPlus - How to get query arguments?


I'm curious how I can take query arguments coming from the GET method in Flask-RESTPlus. I didn't managed to find an example in the documentation.

I have previously used pure flask and the way I was doing it was by calling 'request.args.get()' from the flask library. Any ideas how to achieve this in RESTPlus?


Solution

  • I think the most correct solution I found is to use the request parser:

    parser = api.parser()
    parser.add_argument('user', location='args', help='Queried user')
    

    It is discontinued from RESTPlus. But it is not going any time soon as they have mentioned.