Access json content of http post request with Klein in python
<p>I have a simple http client in python that send the http post request like this:</p>

<pre><code>import json
import urllib2
from collections import defaultdict as dd
data = dd(str)
req = urllib2.Request('http://myendpoint/test')
data["Input"] = "Hello World!"
response = urllib2.urlopen(req, json.dumps(data))
</code></pre>

<p>On my server side with Flask, I can define a simple function</p>

<pre><code>from flask import request
@app.route('/test', methods = ['POST'])
def test():
    output = dd()
    data = request.json
</code></pre>

<p>And the <code>data</code> on server will be the same dictionary as the <code>data</code> on the client side.</p>

<p>However, now I am moving to Klein, so the server code looks like this:</p>

<pre><code>@app.route('/test', methods = ['POST'])
@inlineCallbacks
def test(request):
    output = dd()
    data = request.json &lt;=== This doesn't work
</code></pre>

<p>and the request that's been used in Klein does not support the same function. I wonder is there a way to get the json in Klein in the same way I got it in Flask? Thank you for reading this question.</p>