I've trying to locate what is the problem because whatever example I see, none mentions a similar issue when using request args.
This is my code:
@api.route('/clothing/category', methods=['GET'])
def get_clothing_by_category():
if request.args:
args = request.args
if "foo" in args:
foo = args["foo"]
if "bar" in args:
bar = args.get("bar")
if "baz" in args:
baz = args["baz"]
if "title" in request.args:
title = request.args.get("title")
serialized = ", ".join(f"{k}: {v}" for k, v in request.args.items())
return f"(Query) {serialized}", 200
else:
return "No query string received", 200
I've tried declaring global args and doesn't work either. And I really don't know how to solve the problem.
Many thanks!