import grpc import logging import predict_pb2, predict_pb2_grpc def run(): option = [('grpc.keepalive_timeout_ms', 10000)] with grpc.insecure_channel(target='localhost:50051', options=option) as channel: stub = predict_pb2_grpc.PredictStub(channel) response = stub.PayDay( predict_pb2.RequestPay(Hour=0,Coin=100,YesterdayCoin=100), timeout=10) print(response, type(response.Header.Code)) response = stub.GiftDay(predict_pb2.RequestGift(Hour=0,Coin=100,YesterdayCoin=100), timeout=10) print(response, type(response.Header.Code)) if __name__ == '__main__': logging.basicConfig() run()