Getting the array as GET query parameters in Python Getting the array as GET query parameters in Python python python

Getting the array as GET query parameters in Python


The deep parsing of argument names is unique for PHP AFAIK.

If you need just a simple list, just pass several parameters with the same name and use request.args.getlist(<paramname>) (documentation).

Otherwise you have to parse the query string yourself.


request.args is a MultiDict instance (MultiDict, Flask request api).

request.args[key] ## returns a single value, the first if there are multiplerequest.args.getlist(key) ## returns a list

If you want to submit structures more complex than can be encoded using simple key:vals, consider sending a json encoded object.

Also, look at the jQuery recursive param serialisation pattern, and the jquery-unparam lib which can deserialise it.