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

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.1.0
File Size Uploaded Provenance
quba_sensitive_data_protection-0.1.0.tar.gz 18.0 kB With provenance Details

Built distribution (wheel)

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

Total release size: 67.0 kB

Release files / quba_sensitive_data_protection-0.1.0.tar.gz

Download URL quba_sensitive_data_protection-0.1.0.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0cc508817877c028222cbb6e4856442274be01972cab9b4c4e4eb4f5e33adde2
BLAKE2b-256 checksum
How to use checksums
acbbbaed0a998777292d90b9eb280bc5a5cfed67a97ee6c4b0a7ba2eedb01128
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 3, 2026.

Transparency log

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

Download URL quba_sensitive_data_protection-0.1.0-py3-none-any.whl
Size 49.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98b08afe6255c30960f8cbb042425ea6813ab87a1ef39aba0fa86627533138c5
BLAKE2b-256 checksum
How to use checksums
3fe037c53f5e4b0dc8ccc37d61d1e55f2b09a5ef27cd45fceeafd08f06611cba
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 3, 2026.

Transparency log

Security for quba-sensitive-data-protection 0.1.0

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.1.0.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 3, 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