How to use the tinyrpc.protocols.msgpackrpc.MSGPACKRPCRequest function in tinyrpc

To help you get started, we’ve selected a few tinyrpc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mbr / tinyrpc / tinyrpc / protocols / msgpackrpc.py View on Github external
def _parse_notification(self, req):
        if not isinstance(req[1], six.string_types):
            raise MSGPACKRPCInvalidRequestError()

        request = MSGPACKRPCRequest()
        request.one_way = True
        request.method = req[1]

        params = req[2]
        # params should not be None according to the spec; if there are
        # no params, an empty array must be used
        if isinstance(params, list):
            request.args = params
        else:
            raise MSGPACKRPCInvalidParamsError(request_id=req[1])

        return request
github mbr / tinyrpc / tinyrpc / protocols / msgpackrpc.py View on Github external
def _parse_request(self, req):
        if not isinstance(req[2], six.string_types):
            raise MSGPACKRPCInvalidRequestError(request_id=req[1])

        request = MSGPACKRPCRequest()
        request.one_way = False
        request.method = req[2]
        request.unique_id = req[1]

        params = req[3]
        # params should not be None according to the spec; if there are
        # no params, an empty array must be used
        if isinstance(params, list):
            request.args = params
        else:
            raise MSGPACKRPCInvalidParamsError(request_id=req[1])

        return request
github mbr / tinyrpc / tinyrpc / protocols / msgpackrpc.py View on Github external
def request_factory(self) -> "MSGPACKRPCRequest":
        """Factory for request objects.

        Allows derived classes to use requests derived from :py:class:`MSGPACKRPCRequest`.

        :rtype: :py:class:`MSGPACKRPCRequest`
        """
        return MSGPACKRPCRequest()