Skip to main content

quba-sensitive-data-protection

A client library for accessing Sensitive Data Protection API — a Python client for detecting and de-identifying sensitive data (PII) in text: scan for entities (emails, names, phone numbers, …) and anonymize them with configurable rules (redact, mask, replace, hash, encrypt).

Installation

pip install quba-sensitive-data-protection
# or
uv add quba-sensitive-data-protection

Quickstart

from quba_sdp import Client, models
from quba_sdp.api import scan_text, anonymize_text

client = Client()  # defaults to the production API; pass base_url=... to override

# --- scan: locate sensitive entities ---
resp = scan_text.sync(client=client, body=models.ScanRequestBody(text="Email me at a@b.com"))
if isinstance(resp, models.ScanResponseBody):
    for r in resp.results:
        print(r.entity_type, r.start, r.end, r.score)

# --- anonymize: transform matches ---
body = models.AnonymizeRequestBody(
    text="Email me at a@b.com",
    rules=[
        models.MaskRule(entities=[models.ModelEntity(value="email")], masking_char="*"),
    ],
)
result = anonymize_text.sync(client=client, body=body)
if isinstance(result, models.AnonymizeResponseBody):
    print(result.text)  # 'Email me at ***********'

Base URL

Client() targets the production API by default. Override it for local or staging:

client = Client(base_url="http://localhost:8000")

Authentication

The production API requires a token — use AuthenticatedClient (it shares the same default base URL):

from quba_sdp import AuthenticatedClient

client = AuthenticatedClient(token="SuperSecretToken")

Calling endpoints

Every operation lives in a module under quba_sdp.api and exposes four functions:

function blocking returns
sync ✅ parsed body, or None for an undocumented/error status
sync_detailed ✅ Response[...] with .status_code, .headers, .parsed
asyncio — like sync, awaitable
asyncio_detailed — like sync_detailed, awaitable

sync returns a union of the success body and any documented error (e.g. HTTPValidationError), so narrow it before use:

r = scan_text.sync(client=client, body=...)
if isinstance(r, models.ScanResponseBody):
    ...  # success
else:
    ...  # HTTPValidationError or None

Async variant:

async with Client() as client:
    resp = await scan_text.asyncio(client=client, body=models.ScanRequestBody(text="..."))

Advanced configuration

Client / AuthenticatedClient accept timeout=, verify_ssl=, headers=, cookies=, and httpx_args= for full control of the underlying httpx client (see the Client docstring). Disabling TLS verification is a security risk:

client = Client(verify_ssl=False)  # not recommended

Metadata

Release files for quba-sensitive-data-protection 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quba-sensitive-data-protection 0.2.3
File Size Uploaded Provenance Actions
quba_sensitive_data_protection-0.2.3.tar.gz 52.1 kB With provenance Details for quba_sensitive_data_protection-0.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quba-sensitive-data-protection 0.2.3
File Interpreter ABI Platform Actions
quba_sensitive_data_protection-0.2.3-py3-none-any.whl Python 3 none any Details for quba_sensitive_data_protection-0.2.3-py3-none-any.whl

Total release size: 171.1 kB

Release files / quba_sensitive_data_protection-0.2.3.tar.gz

Download URL quba_sensitive_data_protection-0.2.3.tar.gz
Size 52.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9d6bedc00e0ae2ae9cb0e279086fb277558706558b80d2ad91c78276871395d4
BLAKE2b-256 checksum
How to use checksums
69ee3a9c2f4bab32190d078be6ca92eef5ac289d5b4dd7e1ce0491cce8a3ab8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / quba_sensitive_data_protection-0.2.3-py3-none-any.whl

Download URL quba_sensitive_data_protection-0.2.3-py3-none-any.whl
Size 119.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75d1478ccd6275feab2e9bce9e44ecb7cac2ea43851c1afa892f9ff1ade992eb
BLAKE2b-256 checksum
How to use checksums
d86047957474201f9d82f28c521c5f20bf2621b7e7d0b02337082b524aad33cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for quba-sensitive-data-protection 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for quba_sensitive_data_protection-0.2.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page