def sayHello(self, context, request): print('context', context) print('request', repr(request)) print('request.name', request.name) print('request.ver', request.ver) print('request.bloodType', request.bloodType) return helloworld_pb2.HelloReply( message="Hello {}!".format(request.name) )
def sayHello(self, request, context): print('request', request) print(repr(request.name)) print(repr(request.ver)) print(repr(request.bloodType)) print('context', context) # if request.bloodType == helloworld_pb2.HelloRequest.B: # context.set_code(grpc.StatusCode.INVALID_ARGUMENT) # context.set_details('bloodType B is not acceptable') # raise Exception('bloodType mismatch') return helloworld_pb2.HelloReply( message='Hello {}!'.format(request.name))
async def SayHello(self, request, context): return helloworld_pb2.HelloReply(message='Hello, %s!' % request.name)
def SayHello(self, request, context): print('hahahha %s' % request.name) return helloworld_pb2.HelloReply(message='wocaocao, %s!' % request.name)