MCPcopy
hub / github.com/AirtestProject/Poco / jsonrpc

Method jsonrpc

poco/utils/simplerpc/jsonrpc/backend/flask.py:46–67  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

44 return self.jsonrpc
45
46 def jsonrpc(self):
47 request_str = self._get_request_str()
48 try:
49 jsonrpc_request = JSONRPCRequest.from_json(request_str)
50 except (TypeError, ValueError, JSONRPCInvalidRequestException):
51 response = JSONRPCResponseManager.handle(
52 request_str, self.dispatcher)
53 else:
54 jsonrpc_request.params = jsonrpc_request.params or {}
55 jsonrpc_request_params = copy.copy(jsonrpc_request.params)
56 t1 = time.time()
57 response = JSONRPCResponseManager.handle_request(
58 jsonrpc_request, self.dispatcher)
59 t2 = time.time()
60 logger.info('{0}({1}) {2:.2f} sec'.format(
61 jsonrpc_request.method, jsonrpc_request_params, t2 - t1))
62
63 if response:
64 response.serialize = self._serialize
65 response = response.json
66
67 return Response(response, content_type="application/json")
68
69 def jsonrpc_map(self):
70 """ Map of json-rpc available calls.

Callers

nothing calls this directly

Calls 4

_get_request_strMethod · 0.95
handleMethod · 0.80
from_jsonMethod · 0.45
handle_requestMethod · 0.45

Tested by

no test coverage detected