How to send a dictionary through params webapp2 python?

时间:2017-11-08 21:59:17

标签: python alamofire webapp2

I have a dictionary in Swift like so:

let params : [String : Any] =

["user_key": "ag1kZXZ-Z29hbC1yaXNlchELEgRVc2VyGICAgICAgIAKDA", "post_text": "Lol", "trip": ["posted_by": "", "endAddress": "", "post_text": "Lol", "startAddress": ["state": "IL", "city": "Oak Park", "address1": "6503 West North Avenue", "address2": "", "zipCode": ""], "time": "", "role": "", "eta": ""]]

When I send this in the params object of Alamofire, the webapp2 accesses the params by self.request.get('user_key') and so forth, however, it does not get the 'trip' parameter. ```self.request.get('trip') returns nothing.

How do I send this dictionary to webapp2 Request Handler?

1 个答案:

答案 0 :(得分:1)

要访问旅行词典,您需要使用:

class CreateMediaPostTaskHandler(webapp2.RequestHandler): def post(self): params = self.request.params start_address_city = params['trip[startAddress][city]']