I am using flask-apispec
with webargs
to define the types of a simple API. I have produced a minimal example, below, that reproduces the issue, which is that the kwargs
object is empty.
Server code:
import flask
from flask_apispec import use_kwargs
from webargs import fields
app = flask.Flask(__name__)
@app.route('/pets', methods=["GET"])
@use_kwargs({'species': fields.Str()})
def list_pets(**kwargs):
assert False, kwargs # NO DATA HERE
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
Simple client script:
import requests
requests.get("http://localhost:5000/pets", params={"species": "cat"})
Why is the kwargs
dict empty? I don't see how the above is at all different from the example in the flask-apispec documentation.