def send_confirmation_email(email, order): channel = grpc.insecure_channel('0.0.0.0:8080') stub = demo_pb2_grpc.EmailServiceStub(channel) try: response = stub.SendOrderConfirmation( demo_pb2.SendOrderConfirmationRequest(email=email, order=order)) logger.info('Request sent.') except grpc.RpcError as err: logger.error(err.details()) logger.error('{}, {}'.format(err.code().name, err.code().value))
def send_confirmation_email(email, order): channel = grpc.insecure_channel("0.0.0.0:8080") channel = grpc.intercept_channel(channel, tracer_interceptor) stub = demo_pb2_grpc.EmailServiceStub(channel) try: response = stub.SendOrderConfirmation( demo_pb2.SendOrderConfirmationRequest(email=email, order=order)) logger.info("Request sent. response: {}".format(response)) except grpc.RpcError as err: logger.error(err.details()) logger.error("{}, {}".format(err.code().name, err.code().value))