I'm using Flask framework to create the rest API. the code below is the rest I've wrote.
@app.route("/posts/v2/list_by_date", methods=['GET'])
def public_posts_list_by_date():
tracker_id = request.args.get('tracker_id')
advanced_filters = request.args.get('filters')
if advanced_filters:
advanced_filters = json.loads(advanced_filters)
else:
advanced_filters = {}
the 'filters' is an array of parameters such as start_date, limit, offset, end_date.
And I want to test the rest and I used this command to test it:
curl http://172.31.32.22:3100/posts/v2/list_by_date?tracker_id=6939&filters=start_date=2020-11-30T15:05:05&end_date=2021-01-20T15:05:05
The problem is I don't receive the parameters of the filters in flask, it always empty.
I tried the above command and many other curl commands But still, it doesn't send the filters parameters.
question from:
https://stackoverflow.com/questions/65907824/test-flask-rest-using-curl-get-request-with-multiple-query-parameters 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…