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

Method handle

poco/utils/simplerpc/jsonrpc/manager.py:45–59  ·  view source on GitHub ↗
(cls, request_str, dispatcher)

Source from the content-addressed store, hash-verified

43
44 @classmethod
45 def handle(cls, request_str, dispatcher):
46 if isinstance(request_str, bytes):
47 request_str = request_str.decode("utf-8")
48
49 try:
50 json.loads(request_str)
51 except (TypeError, ValueError):
52 return JSONRPC20Response(error=JSONRPCParseError()._data)
53
54 try:
55 request = JSONRPCRequest.from_json(request_str)
56 except JSONRPCInvalidRequestException:
57 return JSONRPC20Response(error=JSONRPCInvalidRequest()._data)
58
59 return cls.handle_request(request, dispatcher)
60
61 @classmethod
62 def handle_request(cls, request, dispatcher):

Calls 5

JSONRPC20ResponseClass · 0.85
JSONRPCParseErrorClass · 0.85
from_jsonMethod · 0.45
handle_requestMethod · 0.45