Skip to main content

Redact | Python SDK

The Pangea Redact API helps developers limit the sprawl of sensitive information by performing redaction using defined rules.

Redact client

Redact(token, config, logger_name, config_id)

Initializes a new Redact client.

required parameters

str

Pangea API token.

optional parameters

PangeaConfig | None

Configuration.

str

Logger name.

str | None

Configuration ID.

config = PangeaConfig(domain="pangea_domain")
redact = Redact(token="pangea_token", config=config)

download-file

Redact.download_file()

Poll result

Redact.poll_result(exception)

Returns request's result that has been accepted by the server

optional parameters

Optional[AcceptedRequestException]

Exception that was previously raised by the SDK on a call that is being processed.

Response Object

PangeaResponse

response = service.poll_result(exception)

Redact

Redact.redact(text, debug, rules, rulesets, return_result, redaction_method_overrides)

Redact sensitive information from provided text.

required parameters

str

The text data to redact

optional parameters

bool

Setting this value to true will provide a detailed analysis of the redacted data and the rules that caused redaction

list[str]

An array of redact rule short names

list[str]

An array of redact rulesets short names

bool

Setting this value to false will omit the redacted result only returning count

Optional[RedactionMethodOverrides]

A set of redaction method overrides for any enabled rule. These methods override the config declared methods

Response Object

Pangea Response with redacted text in the response.result property, available response fields can be found in our API Documentation.

response = redact.redact(text="Jenny Jenny... 555-867-5309")

Redact structured

Redact.redact_structured(data, jsonp, format, debug, rules, rulesets, return_result, redaction_method_overrides)

Redact sensitive information from structured data (e.g., JSON).

required parameters

dict, str

Structured data to redact

optional parameters

list[str]

JSON path(s) used to identify the specific JSON fields to redact in the structured data. Note: If jsonp parameter is used, the data parameter must be in JSON format.

RedactFormat

The format of the passed data. Default: "json"

bool

Setting this value to true will provide a detailed analysis of the redacted data and the rules that caused redaction

list[str]

An array of redact rule short names

list[str]

An array of redact rulesets short names

bool

Setting this value to false will omit the redacted result only returning count

Optional[RedactionMethodOverrides]

A set of redaction method overrides for any enabled rule. These methods override the config declared methods

Response Object

Pangea Response with redacted data in the response.result field, available response fields can be found in our API Documentation

data = {
    "number": "555-867-5309",
    "ip": "1.1.1.1",
}

response = redact.redact_structured(data=data, redact_format="json")

Unredact

Redact.unredact(redacted_data, fpe_context)

Decrypt or unredact fpe redactions

required parameters

RedactedData

Data to unredact

base64

FPE context used to decrypt and unredact data

Response Object

Pangea Response with redacted data in the response.result field, available response fields can be found in our API Documentation