from aiohttp import web routes = web.RouteTableDef() @routes.get("/some/path") async def handle_this_path(req : web.Request) -> web.Response: return web.Response(status=500, text='Server is incomplete') @routes.get("/") async def handle_root(req : web.Request) -> web.Response: import random num = random.randrange(100, 1000) return web.Response(text='Your luck number is '+str(num)) if __name__ == '__main__': app = web.Application() app.add_routes(routes) web.run_app(app) # this function never returns