Metadata-Version: 2.4
Name: spidercob
Version: 0.1.0
Summary: Python SDK for the Spidercob DLP API — scan, detect, and remediate sensitive data at scale
Project-URL: Homepage, https://spidercob.com
Project-URL: Repository, https://github.com/SpiderCob/spidercob-python
Project-URL: Bug Tracker, https://github.com/SpiderCob/spidercob-python/issues
License: Apache-2.0
Keywords: compliance,data-loss-prevention,dlp,gdpr,hipaa,pci-dss,pii,privacy,secrets,security,spidercob
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: responses>=0.25; extra == 'dev'
Description-Content-Type: text/markdown

# spidercob

Python SDK for the [Spidercob](https://spidercob.com) DLP API.

Scan text, files, and data pipelines for PII, secrets, and sensitive data. Get AI-powered analysis, compliance alerts, and remediation guidance — all from a single API call.

```python
from spidercob import Client

client = Client(api_key="your-api-key")
result = client.scan("postgresql://admin:s3cr3t@prod-db:5432/mydb")

print(result.highest_severity)       # CRITICAL
print(result.critical[0].type)       # db_connection_string
print(result.ai_insight)             # CISO-grade analysis
print(result.compliance_alerts)      # ["PCI-DSS", "SOC2"]
```

## Install

```bash
pip install spidercob
```

Zero dependencies. Python 3.9+.

Get your API key at [spidercob.com/settings](https://spidercob.com/settings).

## Authentication

```python
# Pass directly
client = Client(api_key="your-api-key")

# Or set environment variable
export SPIDERCOB_API_KEY=your-api-key
client = Client()
```

## Scan text

```python
result = client.scan("My SSN is 432-78-9012 and AWS key AKIAIOSFODNN7EXAMPLE")

result.has_findings          # True
result.highest_severity      # "CRITICAL"
result.critical              # list[Finding]
result.high
result.medium
result.low

# Each Finding:
f = result.critical[0]
f.type                       # "aws_access_key"
f.description                # "AWS Access Key ID"
f.value                      # masked value
f.severity                   # "CRITICAL"
f.position                   # "char 10-30"
f.remediation                # "Rotate this key immediately in AWS IAM"

# AI analysis
result.ai_insight            # CISO-grade explanation
result.compliance_alerts     # ["PCI-DSS 3.2", "SOC 2 CC6"]
result.threat_score          # 0-100
```

## Scan a file

```python
result = client.scan_file("src/config.py")
if result.has_findings:
    print(result.to_dict())
```

## Retrieve past scans

```python
# Get a scan by ID
result = client.get_scan(scan_id=1234)

# List recent scans
scans = client.list_scans(limit=20)
```

## Use in CI

```python
import sys
from spidercob import Client

client = Client()
result = client.scan_file("config.py")

if result.critical:
    for f in result.critical:
        print(f"CRITICAL: {f.type} at {f.position}")
        print(f"  Remediation: {f.remediation}")
    sys.exit(1)
```

## Error handling

```python
from spidercob import Client, AuthenticationError, RateLimitError, SpidercobError

try:
    result = client.scan(text)
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Rate limit hit — slow down or upgrade plan")
except SpidercobError as e:
    print(f"API error {e.status_code}: {e}")
```

## Free tier — no API key needed

Want to scan locally without an API key? Use [dlp-patterns](https://github.com/SpiderCob/dlp-patterns) — the open source pattern engine this SDK is built on:

```bash
pip install dlp-patterns
```

The SDK adds: AI-powered CISO analysis, compliance mapping (GDPR/HIPAA/PCI-DSS/SOC2), audit logs, dashboard, team management, and policy enforcement.

## License

Apache 2.0
