I'm using Resource
class from flask restful and use_kwargs
decorator for get method. Here is the code:
@api.resource('/route/')
class API(Resource):
@use_kwargs({'param': fields.Str(missing='default_val')}
def get(self, param):
return {'param': param}
But I can not pass parameters via URL. It always returns missing value. These URL's don't work:
/route?param=smth
/route/?param=smth
Same for use_args
. However I can see my params in flask.request.args
.
Since webargs 6, you need to specify the location explicitly.
@api.resource('/route/')
class API(Resource):
@use_kwargs({'param': fields.Str(missing='default_val')}, location="query")
def get(self, param):
return {'param': param}