从 aiohttp POST 请求中提取 json post 参数
Extracting the json post parameter from aiohttp POST Request
目前我正在做这样的事情
app.router.add_route('POST', '/foo/{par}', foo_test)
如何从请求
中提取POST的正文
@asyncio.coroutine
def foo_test(request):
body = request.content.read() #returns a generator
我的问题是如何从返回的生成器中提取正文?
body = yield from request.json()
目前我正在做这样的事情
app.router.add_route('POST', '/foo/{par}', foo_test)
如何从请求
中提取POST的正文@asyncio.coroutine
def foo_test(request):
body = request.content.read() #returns a generator
我的问题是如何从返回的生成器中提取正文?
body = yield from request.json()