aiohttp: how-to retrieve the data (body) in aiohttp server from requests.get aiohttp: how-to retrieve the data (body) in aiohttp server from requests.get python-3.x python-3.x

aiohttp: how-to retrieve the data (body) in aiohttp server from requests.get


ahh the data part is accessed like that

await request.json()

You can find this in official aiohttp docs


It depends on the format you want the data to be.

To get a string:

request.text()

To get bytes:

request.read()

To get a JSON dict (Attention, throws a json.decoder.JSONDecodeError if the data is malformatted!):

request.json()


you can access POST request body data using

if request.body_exists:        print(await request.read())