webob

Google App Engine: Python: WebOb: How to get POST data in JSON format?

China☆狼群 提交于 2019-12-10 22:41:45
问题 I am building a web app on the Google App Engine platform, which uses webapp2, which uses WebOb. I would like to POST some data in JSON format, including nested arrays and dictionaries. E.g.: $.post('/addvendor', {'vendor': {'name': 'test', 'description': 'a good company', 'tags':['foo', 'bar']}}, function(data){console.log(data)}, 'application/json') However, on the server side, the data comes in as a flat "MultiDict" object, not anything like the original nested JSON object that I POST ed.

I'm using Pylons and having issues with response.set_cookie

六眼飞鱼酱① 提交于 2019-12-09 22:06:40
问题 I am thinking one of the versions of Pylons is different but I could not find an easy way to tell what versions I was running. In the first example I am fairly certain it is 0.9.7 and up using webob to set the cookie. This environment is setting the @ symbol to \100. As you can see in the other environment doing the exact same thing sets the value properly. Any assistance would be appreciated if you need further information let me know. Newer version of Pylons (I think) setting the value

I'm using Pylons and having issues with response.set_cookie

放肆的年华 提交于 2019-12-04 17:04:24
I am thinking one of the versions of Pylons is different but I could not find an easy way to tell what versions I was running. In the first example I am fairly certain it is 0.9.7 and up using webob to set the cookie. This environment is setting the @ symbol to \100. As you can see in the other environment doing the exact same thing sets the value properly. Any assistance would be appreciated if you need further information let me know. Newer version of Pylons (I think) setting the value incorrectly response.set_cookie('email', 'user@domain.com', max_age=3600) response.headers ResponseHeaders(

How to convert a MultiDict to nested dictionary

杀马特。学长 韩版系。学妹 提交于 2019-11-30 02:41:53
问题 I would like to convert a POST from Webob MultiDict to nested dictionary. E.g. So from a POST of: 'name=Kyle&phone.number=1234&phone.type=home&phone.number=5678&phone.type=work' to a multidict; [('name', 'Kyle'), ('phone.number', '1234'), ('phone.type', 'home'), ('phone.number', '5678'), ('phone.type', 'work')] to a nested dictionary {'name': 'Kyle', 'phone': [ { 'number': '12345', 'type': 'home', },{ 'number': '5678', 'type': 'work', }, Any ideas? EDIT I ended up extracting the variable