sasvi.redaction
Redact credentials from HTTP text and headers before they are shown or logged.
These are the rules the SDK applies to its own HTTP logs and error messages,
exposed for code that prints responses itself, such as sasvi raw.
redact_text
def redact_text(text: str, *, content_type: str = "text/plain") -> str
Return text with credentials replaced by <redacted>.
Masks the values of credential-named keys (password, access_token,
client_secret and the rest of the SDK's vocabulary) in JSON, form and
plain text, and bearer, Basic and JWT values that appear without a key.
A JSON body that does not parse is replaced whole rather than shown.
Arguments:
text- A response or request body, or any message.content_type- The body's media type.jsonandx-www-form-urlencodedbodies are parsed; anything else is treated as text.
Returns:
The redacted text.
redact_headers
def redact_headers(
headers: Mapping[str, str],
*,
redacted_headers: frozenset[str] = DEFAULT_REDACTED_HEADERS
) -> dict[str, str]
Return a copy of headers with credential-bearing values replaced.
Arguments:
headers- HTTP headers.redacted_headers- Lower-case header names whose values are hidden. Defaults to the SDK's list (authorization,cookie,set-cookie,x-api-keyand others).
Returns:
A new dict with the same names.