I'd like to use aiohttp-swagger in my python Project but I can't figure out how it handles GET URL and POST payload variables. I have this sample code based on the quick start example here. The only change I made is that I included a query parameter in the GET URL.
from aiohttp import web
from aiohttp_swagger import *
async def ping(request):
"""
---
description: This end-point allow to test that service is up.
tags:
- Health check
produces:
- text/plain
responses:
"200":
description: successful operation. Return "pong" text
"405":
description: invalid HTTP Method
"""
return web.Response(text="pong %s" % request.match_info['var']) # change here (1/2)
app = web.Application()
app.router.add_route('GET', "/ping/{var}", ping) # change here (2/2)
setup_swagger(app)
web.run_app(app, host="127.0.0.1")
The Swagger/OpenAPI page that gets generated doesn't seem to be aware of the variable. I expeected that it'd generate a textbox where I can fill in a value for the "var" query variable. How do I do this with aio-http? Is it possible? If not, is there another library that can handle this?
For the record, I have a C# background and I've done this in the past using the Swashbuckle library.