import logging import grpc from ..generated import figure_pb2, figure_pb2_grpc def run() -> None: # NOTE(gRPC Python Team): .close() is possible on a channel and should be # used in circumstances in which the with statement does not fit the needs # of the code. with grpc.insecure_channel("localhost:50051") as channel: stub = figure_pb2_grpc.FigureServiceStub(channel) for figure in stub.GetFigure(figure_pb2.FigureRequest()): print(f"Figure: {figure}") if __name__ == "__main__": logging.basicConfig() run()