When I send a POST message to GAE using json parameters using POST, the QueryDict parsed by the server is not treated as json ...
I found a similar problem in this problem: iphone Json POST request to Django server creates QueryDict in QueryDict
There may be a problem with the GAE configuration. I have Python 2.6.6 with the latest version of GAE. First of all, if I get POST using the nc tool, the POST message is perfect:
POST /url/ HTTP/1.1
Accept: application/jsonrequest
Content-type: application/json
Accept-Encoding: gzip
Content-Length: 458
Host: 192.168.1.1:8080
Connection: Keep-Alive
{"id":"xxx","jsonrpc":"2.0","method":"XXX","params":{...}]}
And in the server console, I get the following messages:
DEBUG 2010-09-16 06:47:05,891 dev_appserver.py:1693] Access to module file denied: /usr/lib/pymodules/python2.6/simplejson
DEBUG 2010-09-16 06:47:05,894 dev_appserver.py:1700] Could not import "_json": Disallowed C-extension or built-in module
DEBUG 2010-09-16 06:47:05,897 dev_appserver.py:1700] Could not import "_json": Disallowed C-extension or built-in module
And the idea?
Dict request on server <QueryDict: {u'{"id":"xxx","jsonrpc":"2.0","method":"XXX","params":{...}}': [u'']}>
As you can check the django handler, parse the json of the POST request as the key of the new dictionary ...
In a related issue, there is the following solution ...
hack_json_value = request.POST.keys()[0]
hack_query_dict = json.loads(hack_json_value)
foo = hack_query_dict['foo']
bar = hack_query_dict['bar']
but maybe you can help me find another one ...
Thank,