I use Flask Restful for my server API and send a dictionary to the server, where one of the values ββis a list of dictionaries.
parser.add_argument('products_in_basket', type=list) def post(self, user_id): args = parser.parse_args() print request.data print args['my_list']
I have a problem: args ['my_list'] returns only the first element of the list. While I see the whole list from request.data.
This is request.data p>
{"address_id":1,"my_list":[{"size":12,"colour":"red","id":34219,"quantity":1},{"size":10,"colour":"red","id":12219,"quantity":2},{"size":8,"colour":"red","id":5214,"quantity":3}],"payment_card_id":1}
This is args ['my_list']
[u'colour', u'quantity', u'id', u'size']
Where am I going wrong?
user4591756
source share