in callouts/python/extproc/service/callout_tools.py [0:0]
def deny_callout(context, msg: str | None = None) -> None:
"""Denies a gRPC callout, optionally logging a custom message.
Args:
context (grpc.ServicerContext): The gRPC service context.
msg (str, optional): Custom message to log before denying the callout.
Also logged to warning. If no message is specified, defaults to "Callout DENIED.".
Raises:
grpc.StatusCode.PERMISSION_DENIED: Always raised to deny the callout.
"""
msg = msg or 'Callout DENIED.'
logging.warning(msg)
context.abort(grpc.StatusCode.PERMISSION_DENIED, msg)