7👍
The first thing you need to remember when working with json is that AppEngine lives with python 2.5. This means json is not a standard part of python yet.
To solve that bit I found simplejson somewhere online and packed it together with my code. The API for built-in json and simplejson are essentially the same (or maybe I’ve just not noticed anything different) so just import it like so:
import simplejson as json
And use it like you’re used to.
Now, as for the QueryDict. Yes, what you’re getting through is raw POST data, there is no logical reason for it to get parsed as json and play pretend that it’s a normal query-based POST request. Honestly, I never thought django was even able of making this leap of judgement for us. So, to get to your data use something along these lines:
data = json.loads(request.raw_post_data)
For reference of what django was expecting to see in the raw POST data check here: http://en.wikipedia.org/wiki/POST_(HTTP), specifically the bit about how application/x-www-form-urlencoded works.
1👍
request.raw_post_data
is deprecated in Django 1.4.3
and removed in 1.5
https://github.com/django/django/commit/4a6490a4a0d0d7e45b1f549e3f9d97e5e2aeb731
- [Django]-How to load fixtures.json with ManyToMany Relationships in Django
- [Django]-Django problem with extends template tag
1👍
import simplejson
and use
data = simplejson.loads(request.body)
instead request.raw_post_data
- [Django]-ModuleNotFoundError: No module named 'ebcli'
- [Django]-Graphene-Django nested filters (relay)