from tornado import ioloop, web
from jsonrpcserver import method, async_dispatch as dispatch


@method
async def ping():
    return "pong"


class MainHandler(web.RequestHandler):
    async def post(self):
        request = self.request.body.decode()
        response = await dispatch(request)
        print(response)
        if response.wanted:
            self.write(str(response))


app = web.Application([(r"/", MainHandler)])

if __name__ == "__main__":
    app.listen(5000)
    ioloop.IOLoop.current().start()

from tornado import ioloop, web
from jsonrpcserver import method, async_dispatch as dispatch


@method
async def ping() -> str:
    return "pong"


class MainHandler(web.RequestHandler):
    async def post(self) -> None:
        request = self.request.body.decode()
        response = await dispatch(request)
        if response.wanted:
            self.write(str(response))


app = web.Application([(r"/", MainHandler)])

if __name__ == "__main__":
    app.listen(5000)
    ioloop.IOLoop.current().start()

Remove unwanted print statement from example
Remove unwanted print statement from example

  from tornado import ioloop, web
  from jsonrpcserver import method, async_dispatch as dispatch
  
  
  @method
- async def ping():
+ async def ping() -> str:
      return "pong"
  
  
  class MainHandler(web.RequestHandler):
-     async def post(self):
+     async def post(self) -> None:
          request = self.request.body.decode()
          response = await dispatch(request)
-         print(response)
          if response.wanted:
              self.write(str(response))
  
  
  app = web.Application([(r"/", MainHandler)])
  
  if __name__ == "__main__":
      app.listen(5000)
      ioloop.IOLoop.current().start()
  
Remove unwanted print statement from example
## Code Before:
from tornado import ioloop, web
from jsonrpcserver import method, async_dispatch as dispatch


@method
async def ping():
    return "pong"


class MainHandler(web.RequestHandler):
    async def post(self):
        request = self.request.body.decode()
        response = await dispatch(request)
        print(response)
        if response.wanted:
            self.write(str(response))


app = web.Application([(r"/", MainHandler)])

if __name__ == "__main__":
    app.listen(5000)
    ioloop.IOLoop.current().start()

## Instruction:
Remove unwanted print statement from example
## Code After:
from tornado import ioloop, web
from jsonrpcserver import method, async_dispatch as dispatch


@method
async def ping() -> str:
    return "pong"


class MainHandler(web.RequestHandler):
    async def post(self) -> None:
        request = self.request.body.decode()
        response = await dispatch(request)
        if response.wanted:
            self.write(str(response))


app = web.Application([(r"/", MainHandler)])

if __name__ == "__main__":
    app.listen(5000)
    ioloop.IOLoop.current().start()
