File: sanic.py

package info (click to toggle)
python-ajsonrpc 1.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 524 kB
  • sloc: python: 1,286; makefile: 56; sh: 17
file content (12 lines) | stat: -rw-r--r-- 409 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
from sanic.response import json as json_response
from .common import CommonBackend

class JSONRPCSanic(CommonBackend):    
    @property
    def handler(self):
        """Get Sanic Handler"""
        async def handle(request):
            response = await self.manager.get_response_for_payload(request.body)
            return json_response(response.body, dumps=self.manager.serialize)

        return handle