I'm trying to create filters on our REST API using Flask, but Flask only seems to return a single argument when the same key is duplicated in the query string.
For example:
from flask import Flask
from flask import jsonify
from flask import request
app = Flask(__name__)
@app.route('/')
def hello_world():
return jsonify(request.args)
For request <localhost>/?test=a&test=b, the result is:
{
"test": "a"
}
Since I want to reuse the filter argument to represent the AND logic for filtering, it would be convenient if Flask supported this. I realize that under the covers, Flask parses the request.args into a MultiDict object, which is probably why it cannot return multiple keys of the same name.
I assume I can access the raw query string somehow in Flask, but I haven't found that yet. I will update this post if I come across a solution, but if anyone else has ideas, please share.