Skip to content

Python SDK API Reference

Ingestion Service

IngestorService

IngestorService(service_uuid)

Opaque Ingestor Service API wrapper.

Parameters:

Name Type Description Default
service_uuid uuid.UUID

The UUID of the ingestor service to use

required

Attributes:

Name Type Description
client RestClient

The client used to make requests to the Opaque REST API.

service_uuid uuid.UUID

The UUID of the ingestor service to consume

ingest

ingest(inputs)

Reads and ingest an external service, based on the service request, provided an URL, an authorization token and a list of headers

Parameters:

Name Type Description Default
inputs list of HttpIngestorRequest

The input http services urls, along with all required headers and methods, to ingest.

required

Returns:

Type Description
IngestorResponse

The ingestor result as a list of texts.

Data Types

HttpIngestorRequest dataclass

A data class representing an HTTP request to be used by an ingestor.

Attributes:

Name Type Description
url str

The URL of the HTTP request. This field is required and must be a non-empty string.

method HttpMethod

The HTTP method (e.g., GET, POST). This field is required and must be of type HttpMethod.

body str

The body content of the HTTP request. Defaults to an empty string.

headers dict of str, str

A dictionary of HTTP headers. Defaults to an empty dictionary. Keys and values must be strings.

IngestorResponse dataclass

Class representing the return value of the ingest method

Attributes:

Name Type Description
texts list of str

The result of the ingestor service call, as a list of texts.

Enums

HttpMethod

Bases: str, Enum

Enum for HTTP methods.

Represents the standard HTTP methods used in web communication.

Attributes:

Name Type Description
GET str

Represents the HTTP GET method, typically used for retrieving data from a server.

POST str

Represents the HTTP POST method, typically used for submitting data to a server.

Redaction Service

RedactionService

RedactionService(service_uuid)

Opaque Redaction Service API wrapper.

Parameters:

Name Type Description Default
service_uuid uuid.UUID

The UUID of the redaction service to

required

Attributes:

Name Type Description
client RestClient

The client used to make requests to the Opaque REST API.

service_uuid

redact

redact(input_texts)

Redacts sensitive entities in the input texts, in accordance with the configuration of the redaction service.

Parameters:

Name Type Description Default
input_texts list of str

The input texts to redact.

required

Returns:

Type Description
RedactionResponse

The redacted form of the input texts with sensitive entities replaced. Plus the secure context needed to unredact the entities in redacted_texts.

unredact

unredact(redacted_texts, secure_context)

Unredact sensitive entities in the redacted texts, using the information encoded in the secure context.

Parameters:

Name Type Description Default
redacted_texts list of str

The redacted texts with sensitive entities replaced.

required
secure_context str

A set of bytes encoded as a string that contains the context needed to unredact the entities in redacted_texts.

required

Returns:

Type Description
UnredactResponse

The unredacted form of the input texts with sensitive entities replaced

Data Types

RedactionResponse dataclass

Class representing the return value of the redact method

Attributes:

Name Type Description
redacted_texts list of str

The redacted form of the input texts with sensitive entities replaced.

secure_context str

A set of bytes encoded as a string that contains the context needed to unredact the entities in redacted_texts; it must be passed along to the unredact endpoint.

UnredactResponse dataclass

Class representing the return value of the unredact method

Attributes:

Name Type Description
unredacted_texts list of str

The unredacted form of the input texts with sensitive entities replaced.

Was this page helpful?