如何通过params webapp2 python发送字典?
How to send a dictionary through params webapp2 python?
我在 Swift 中有一本字典,如下所示:
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": ""]]
当我在 Alamofire 的 params 对象中发送它时,webapp2 通过 self.request.get('user_key')
等访问参数,但是,它没有获得 'trip' 参数。 ```self.request.get('trip') returns 没什么。
如何将此词典发送到 webapp2 请求处理程序?
要访问旅行词典,您需要使用:
class CreateMediaPostTaskHandler(webapp2.RequestHandler):
def post(self):
params = self.request.params
start_address_city = params['trip[startAddress][city]']
我在 Swift 中有一本字典,如下所示:
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": ""]]
当我在 Alamofire 的 params 对象中发送它时,webapp2 通过 self.request.get('user_key')
等访问参数,但是,它没有获得 'trip' 参数。 ```self.request.get('trip') returns 没什么。
如何将此词典发送到 webapp2 请求处理程序?
要访问旅行词典,您需要使用:
class CreateMediaPostTaskHandler(webapp2.RequestHandler):
def post(self):
params = self.request.params
start_address_city = params['trip[startAddress][city]']