async def method(request):
## here how to get query parameters
param1 = request.rel_url.query['name']
param2 = request.rel_url.query['age']
return web.Response(text=str(result))
if __name__ == '__main__':
app = web.Application()
app.router.add_route('GET', "/sample", method)
web.run_app(app,host='localhost', port=3000)
The above code is running in python 3.6. I need to extract the query parameter values (xyz & xy) from the sample URL http://localhost.com/sample?name=xyz&age=xy. I Tried with req.rel_url.query and also with request.query_string. It was giving only the first parameter value xyz, but I was not getting xy (age) which was the second parameter in the query.
How can I get both the query values?