helloworld_pb2_grpc.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
  2. import grpc
  3. import helloworld_pb2 as helloworld__pb2
  4. class GreeterStub(object):
  5. """The greeting service definition.
  6. """
  7. def __init__(self, channel):
  8. """Constructor.
  9. Args:
  10. channel: A grpc.Channel.
  11. """
  12. self.SayHello = channel.unary_unary(
  13. '/helloworld.Greeter/SayHello',
  14. request_serializer=helloworld__pb2.HelloRequest.SerializeToString,
  15. response_deserializer=helloworld__pb2.HelloReply.FromString,
  16. )
  17. class GreeterServicer(object):
  18. """The greeting service definition.
  19. """
  20. def SayHello(self, request, context):
  21. """Sends a greeting
  22. """
  23. context.set_code(grpc.StatusCode.UNIMPLEMENTED)
  24. context.set_details('Method not implemented!')
  25. raise NotImplementedError('Method not implemented!')
  26. def add_GreeterServicer_to_server(servicer, server):
  27. rpc_method_handlers = {
  28. 'SayHello': grpc.unary_unary_rpc_method_handler(
  29. servicer.SayHello,
  30. request_deserializer=helloworld__pb2.HelloRequest.FromString,
  31. response_serializer=helloworld__pb2.HelloReply.SerializeToString,
  32. ),
  33. }
  34. generic_handler = grpc.method_handlers_generic_handler(
  35. 'helloworld.Greeter', rpc_method_handlers)
  36. server.add_generic_rpc_handlers((generic_handler,))