File: quart.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 (17 lines) | stat: -rw-r--r-- 452 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import json

from quart import Response, request
from .common import CommonBackend


class JSONRPCQuart(CommonBackend):
    @property
    def handler(self):
        """Get Quart Handler"""

        async def handle():
            request_body = await request.body
            response = await self.manager.get_response_for_payload(request_body)
            return Response(json.dumps(response.body), mimetype="application/json")

        return handle