Python SDK for the ClassiFinder secret detection API
Project description
ClassiFinder
Python SDK for the ClassiFinder secret detection API.
Scan text for leaked secrets and credentials, get structured findings, and redact sensitive values -- all in a few lines of Python.
Installation
pip install classifinder
Quick Start
from classifinder import ClassiFinder
client = ClassiFinder(api_key="ss_live_...")
# or set the CLASSIFINDER_API_KEY environment variable
result = client.scan("My AWS key is AKIAIOSFODNN7EXAMPLE")
for finding in result.findings:
print(f"{finding.type_name} (severity={finding.severity}, confidence={finding.confidence})")
print(f" Preview: {finding.value_preview}")
Redact Secrets
The /v1/redact endpoint replaces secrets in-place so you can safely pass text
downstream to LLMs or logging systems.
result = client.redact("DB password is SuperSecret123!")
print(result.redacted_text)
# "DB password is [DATABASE_PASSWORD]!"
print(f"Redacted {result.findings_count} secret(s)")
Async Support
from classifinder import AsyncClassiFinder
async def main():
client = AsyncClassiFinder(api_key="ss_live_...")
result = await client.scan("AKIA...")
await client.close()
LangChain Integration
Guard your LLM chains against secret leakage.
pip install classifinder[langchain]
from classifinder.integrations.langchain import ClassiFinderGuard
guard = ClassiFinderGuard(api_key="ss_live_...", mode="redact")
# Use as a standalone runnable
clean_text = guard.invoke("My token is ghp_abc123secret")
# Chain with other LangChain runnables
chain = guard | your_llm | output_parser
Set mode="block" to raise SecretsDetectedError instead of redacting.
Error Handling
from classifinder import ClassiFinder, AuthenticationError, RateLimitError, ClassiFinderError
client = ClassiFinder(api_key="ss_live_...")
try:
result = client.scan("check this text")
except AuthenticationError:
print("Invalid API key")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except ClassiFinderError as e:
print(f"API error ({e.status_code}): {e.message}")
Documentation
Full API documentation: https://classifinder.tech
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file classifinder-0.1.0.tar.gz.
File metadata
- Download URL: classifinder-0.1.0.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1612db32e21245865905fb6e6223b1c5a5fc710ef99ce7159ad5139d693f0a7
|
|
| MD5 |
ed1c7adb925325eb81e050f54f8fede7
|
|
| BLAKE2b-256 |
e58531749f410caf06da88e14147be79a2e815882fc6f14e02689e9121bd162f
|
File details
Details for the file classifinder-0.1.0-py3-none-any.whl.
File metadata
- Download URL: classifinder-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62ba291dd37251fa73e28c55d8c92318c3c40404c7455b1f70e6054fd9120f68
|
|
| MD5 |
3edbbd0703504c403e5a4cbbe4c3fdfc
|
|
| BLAKE2b-256 |
caa2f5ef39f032425e280e91d69b4fd5d02b49469fe9d04d65497ecb69267249
|