|
| 1 | +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! |
| 2 | +"""Client and server classes corresponding to protobuf-defined services.""" |
| 3 | +import grpc |
| 4 | + |
| 5 | +import helloworld_pb2 as helloworld__pb2 |
| 6 | + |
| 7 | + |
| 8 | +class GreeterStub(object): |
| 9 | + """The greeting service definition. |
| 10 | + """ |
| 11 | + |
| 12 | + def __init__(self, channel): |
| 13 | + """Constructor. |
| 14 | +
|
| 15 | + Args: |
| 16 | + channel: A grpc.Channel. |
| 17 | + """ |
| 18 | + self.SayHello = channel.unary_unary( |
| 19 | + '/helloworld.Greeter/SayHello', |
| 20 | + request_serializer=helloworld__pb2.HelloRequest.SerializeToString, |
| 21 | + response_deserializer=helloworld__pb2.HelloReply.FromString, |
| 22 | + ) |
| 23 | + |
| 24 | + |
| 25 | +class GreeterServicer(object): |
| 26 | + """The greeting service definition. |
| 27 | + """ |
| 28 | + |
| 29 | + def SayHello(self, request, context): |
| 30 | + """Sends a greeting |
| 31 | + """ |
| 32 | + context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
| 33 | + context.set_details('Method not implemented!') |
| 34 | + raise NotImplementedError('Method not implemented!') |
| 35 | + |
| 36 | + |
| 37 | +def add_GreeterServicer_to_server(servicer, server): |
| 38 | + rpc_method_handlers = { |
| 39 | + 'SayHello': grpc.unary_unary_rpc_method_handler( |
| 40 | + servicer.SayHello, |
| 41 | + request_deserializer=helloworld__pb2.HelloRequest.FromString, |
| 42 | + response_serializer=helloworld__pb2.HelloReply.SerializeToString, |
| 43 | + ), |
| 44 | + } |
| 45 | + generic_handler = grpc.method_handlers_generic_handler( |
| 46 | + 'helloworld.Greeter', rpc_method_handlers) |
| 47 | + server.add_generic_rpc_handlers((generic_handler,)) |
| 48 | + |
| 49 | + |
| 50 | + # This class is part of an EXPERIMENTAL API. |
| 51 | +class Greeter(object): |
| 52 | + """The greeting service definition. |
| 53 | + """ |
| 54 | + |
| 55 | + @staticmethod |
| 56 | + def SayHello(request, |
| 57 | + target, |
| 58 | + options=(), |
| 59 | + channel_credentials=None, |
| 60 | + call_credentials=None, |
| 61 | + insecure=False, |
| 62 | + compression=None, |
| 63 | + wait_for_ready=None, |
| 64 | + timeout=None, |
| 65 | + metadata=None): |
| 66 | + return grpc.experimental.unary_unary(request, target, '/helloworld.Greeter/SayHello', |
| 67 | + helloworld__pb2.HelloRequest.SerializeToString, |
| 68 | + helloworld__pb2.HelloReply.FromString, |
| 69 | + options, channel_credentials, |
| 70 | + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) |
0 commit comments