Skip to main content

validate_request

Function validate_request 

Source
pub async fn validate_request(
    token: &str,
    bucket: &str,
    request: &HashMap<String, String>,
    callback: PyObject,
) -> Result<bool, String>
Expand description

Invoke the Python validator callback for a single request.

Inspects the callable’s signature at runtime (via Python’s inspect module) to determine whether it accepts a third request: dict argument. The call is dispatched on a [tokio::task::spawn_blocking] thread so that the Python GIL does not block the async runtime.

Returns Ok(true) if the callback approves the request, Ok(false) if it denies it, or Err(String) on any Python exception.