Ejemplo n.º 1
0
 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)
     )
Ejemplo n.º 2
0
    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))
Ejemplo n.º 3
0
 async def SayHello(self, request, context):
     return helloworld_pb2.HelloReply(message='Hello, %s!' % request.name)
Ejemplo n.º 4
0
 def SayHello(self, request, context):
     print('hahahha %s' % request.name)
     return helloworld_pb2.HelloReply(message='wocaocao, %s!' %
                                      request.name)