aiohttp: how-to retrieve the data (body) in aiohttp server from requests.get
<p>Could you please advise on the following?</p>

<p>On the localhost:8900 there is aiohttp server running</p>

<p>when i do a request like (using the python2 module requests) from python
<code>
requests.get("http://127.0.01:8900/api/bgp/show-route", data={'topo':"switzerland", 'pop':"zrh", 'prefix':"1.1.1.1/32"})
</code></p>

<p>And there is a route defined in the aiohttp server
<code>
app.router.add_route("GET", "/api/bgp/show-route", api_bgp_show_route)
</code></p>

<p>which is being handled like
<code>
def api_bgp_show_route(request):
      pass
</code></p>

<p>The question is: how do i retrieve on server-side the data part of the request ? meaning <code>{'topo':"switzerland", 'pop':"zrh", 'prefix':"1.1.1.1/32"}</code></p>

<p>ahh the <code>data</code> part is accessed like that </p>

<pre><code>await request.json()
</code></pre>

<p>You can find this in official <a href="http://aiohttp.readthedocs.io/en/stable/web_reference.html#aiohttp.web.Request.json" rel="nofollow">aiohttp docs</a></p>

python rest python-3.x aiohttp