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.0.11

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.0.11
File Size Uploaded Provenance
quba_sensitive_data_protection-0.0.11.tar.gz 17.4 kB With provenance Details

Built distribution (wheel)

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

Total release size: 64.9 kB

Release files / quba_sensitive_data_protection-0.0.11.tar.gz

Download URL quba_sensitive_data_protection-0.0.11.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e96ac4bfa258670cfcbecfae3338b15f185c69bb5a088cec106cc5a233155e2a
BLAKE2b-256 checksum
How to use checksums
1b17da48383bd8535c673fa07ae18d002ecb0311c458186bf336bcaffd06f835
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 2, 2026.

Transparency log

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

Download URL quba_sensitive_data_protection-0.0.11-py3-none-any.whl
Size 47.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69d0534f63981c1b2e840835496a6aa87eaaab4619bbcdeac1e153d802504bcb
BLAKE2b-256 checksum
How to use checksums
4f2368822169ccb424066f573a071da4f26e59b0662f248a52c587ece54a5de0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 2, 2026.

Transparency log

Security for quba-sensitive-data-protection 0.0.11

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for quba_sensitive_data_protection-0.0.11.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 Oct 2, 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.

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