0

I have a PasteWSGI server running.

Here is the sample curl request,

curl -vX POST http://127.0.0.1:5000/save_topology --data '{"topo" : {"A": "asdasdasd"}, "house_id" : "2"}'

server side code snippet is,

  def save_topology(self):
    from plotwatt.topology import save

    print request.POST

    topo = request.params.get('topo')
    house_id = request.params.get('house_id')

    return 'OK'

logs,

MultiDict([(u'{"topo" : {"A": "asdasdasd"}, "house_id" : "2"}', u'')])

My question is how can i access passed json as it is in server?

Server details :

Server: PasteWSGIServer/0.5 Python/2.7.3
Aashish P
  • 1,894
  • 5
  • 22
  • 36

1 Answers1

0

I am answering my own question. I needed json data being sent over the wire as it is. I have done something like this,

data = json.loads(urllib.unquote_plus(request.body.strip('=')))

request.body contains the actual data.

You may like to go through API reference http://docs.webob.org/en/latest/modules/webob.html#request

Aashish P
  • 1,894
  • 5
  • 22
  • 36