How to use the protobuf.socketrpc.rpc_pb2 function in protobuf

To help you get started, we’ve selected a few protobuf 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 sdeo / protobuf-socket-rpc / python / src / protobuf / socketrpc / server.py View on Github external
service.CallMethod(method, controller, proto_request, callback)
        except Exception, e:
            raise error.RpcError(unicode(e))

        # Return an RPC response, with payload defined in the callback
        response = rpc_pb.Response()
        if callback.response:
            response.callback = True
            response.response_proto = callback.response.SerializeToString()
        else:
            response.callback = callback.invoked

        # Check to see if controller has been set to not success by user.
        if controller.failed():
            response.error = controller.error()
            response.error_reason = rpc_pb.RPC_FAILED

        return response
github seagoatvision / seagoatvision / protobuf / socketrpc / server.py View on Github external
def parseServiceRequest(self, bytestream_from_client):
        '''Validate the data stream received from the client.'''

        # Convert the client request into a PB Request object
        request = rpc_pb.Request()

        # Catch anything which isn't a valid PB bytestream
        try:
            request.MergeFromString(bytestream_from_client)
        except Exception, e:
            raise error.BadRequestDataError("Invalid request from \
                                            client (decodeError): " + str(e))

        # Check the request is correctly initialized
        if not request.IsInitialized():
            raise error.BadRequestDataError("Client request is missing \
                                             mandatory fields")
        log.debug('Request = %s' % request)

        return request
github sdeo / protobuf-socket-rpc / python / src / protobuf / socketrpc / error.py View on Github external
def __init__(self, message):
        super(MethodNotFoundError, self).__init__(
            message, rpc_pb.METHOD_NOT_FOUND)
github sdeo / protobuf-socket-rpc / python / src / protobuf / socketrpc / error.py View on Github external
def __init__(self, message):
        super(BadRequestDataError, self).__init__(
            message, rpc_pb.BAD_REQUEST_DATA)
github sdeo / protobuf-socket-rpc / python / src / protobuf / socketrpc / server.py View on Github external
def parseServiceRequest(self, bytestream_from_client):
        '''Validate the data stream received from the client.'''

        # Convert the client request into a PB Request object
        request = rpc_pb.Request()

        # Catch anything which isn't a valid PB bytestream
        try:
            request.MergeFromString(bytestream_from_client)
        except Exception, e:
            raise error.BadRequestDataError("Invalid request from \
                                            client (decodeError): " + str(e))

        # Check the request is correctly initialized
        if not request.IsInitialized():
            raise error.BadRequestDataError("Client request is missing \
                                             mandatory fields")
        log.debug('Request = %s' % request)

        return request
github sdeo / protobuf-socket-rpc / python / src / protobuf / socketrpc / error.py View on Github external
def __init__(self, message):
        super(UnknownHostError, self).__init__(message, rpc_pb.UNKNOWN_HOST)
github sdeo / protobuf-socket-rpc / python / src / protobuf / socketrpc / error.py View on Github external
def __init__(self, message):
        super(BadRequestProtoError, self).__init__(
            message, rpc_pb.BAD_REQUEST_PROTO)
github sdeo / protobuf-socket-rpc / python / src / protobuf / socketrpc / error.py View on Github external
def __init__(self, message):
        super(RpcError, self).__init__(message, rpc_pb.RPC_ERROR)
github sdeo / protobuf-socket-rpc / python / src / protobuf / socketrpc / error.py View on Github external
def __init__(self, message):
        super(ServiceNotFoundError, self).__init__(
            message, rpc_pb.SERVICE_NOT_FOUND)
github sdeo / protobuf-socket-rpc / python / src / protobuf / socketrpc / error.py View on Github external
def __init__(self, message):
        super(InvalidRequestProtoError, self).__init__(
            message, rpc_pb.INVALID_REQUEST_PROTO)