ComplianceLayer Python SDK
Official Python SDK for the ComplianceLayer security scanning and compliance monitoring API.
Scan any domain and get a complete security posture report -- DNS, SSL/TLS, open ports, HTTP headers, email authentication, breach exposure, and compliance mapping (SOC 2, PCI DSS, HIPAA, NIST, ISO 27001) -- all from a single API call.
Installation
pip install compliancelayer
Quick start
from compliancelayer import ComplianceLayer
client = ComplianceLayer(api_key="cl_your_key_here")
# Scan a domain (blocks until complete, typically 30-60s)
report = client.scan("example.com")
print(f"Grade: {report.grade}") # "A"
print(f"Score: {report.score}") # 92
print(f"Issues: {report.total_issues}")
for issue in report.findings:
print(f" [{issue.severity}] {issue.finding}")
Async scanning
If you do not want to block, submit the job and poll manually:
job = client.scan_async("example.com")
while not job.is_complete:
job.refresh()
report = job.get_report()
print(report.grade)
Batch scanning
jobs = client.scan_batch(["example.com", "test.com", "demo.org"])
# Wait for all to finish
for job in jobs:
while not job.is_complete:
job.refresh()
report = job.get_report()
print(f"{report.domain}: {report.grade} ({report.score})")
Domain monitoring
# Add a domain for continuous monitoring
domain = client.domains.add("example.com", scan_interval="weekly")
# List all monitored domains
domain_list = client.domains.list()
for d in domain_list.domains:
print(f"{d.domain}: {d.last_grade} (scanned {d.last_scanned_at})")
# Check alerts
alerts = client.domains.alerts(unread_only=True)
for alert in alerts:
print(f"[{alert.severity}] {alert.title}")
# Remove monitoring
client.domains.remove(domain.id)
Account usage
usage = client.usage()
print(f"Plan: {usage.plan}")
print(f"Scans: {usage.scans_used}/{usage.scans_limit}")
print(f"Remaining this month: {usage.scans_remaining}")
print(f"Domain limit: {usage.domains_limit}")
# /v1/auth/me does not report domains in use; read it from the domain list.
print(f"Domains: {client.domains.list().limit_used}/{usage.domains_limit}")
Scan history
history = client.scan_history(limit=10)
for entry in history:
print(f"{entry.domain}: {entry.grade} ({entry.scanned_at})")
Error handling
from compliancelayer import (
ComplianceLayer,
AuthenticationError,
QuotaExceededError,
RateLimitError,
ScanTimeoutError,
)
client = ComplianceLayer(api_key="cl_your_key_here")
try:
report = client.scan("example.com")
except AuthenticationError:
print("Invalid API key")
except QuotaExceededError:
print("Monthly scan quota exceeded -- upgrade your plan")
except RateLimitError as e:
print(f"Rate limited, retry after {e.retry_after}s")
except ScanTimeoutError:
print("Scan took too long -- try again or increase poll_timeout")
Configuration
client = ComplianceLayer(
api_key="cl_your_key_here",
base_url="https://api.compliancelayer.net", # default
timeout=30.0, # HTTP request timeout (seconds)
poll_interval=3.0, # Seconds between status polls
poll_timeout=120.0, # Max seconds to wait for scan completion
max_retries=3, # Auto-retries on 429/5xx errors
)
Requirements
- Python 3.9+
- httpx >= 0.24.0
Links
- Homepage: https://compliancelayer.net
- API Docs: https://compliancelayer.net/docs
- Source: https://github.com/ChainKings/compliancelayer (SDK lives under
sdk/python) - Issues: https://github.com/ChainKings/compliancelayer/issues
License
MIT
Metadata
Release files for compliancelayer 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| compliancelayer-0.1.1.tar.gz | 20.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| compliancelayer-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.3 kB
Release files / compliancelayer-0.1.1.tar.gz
| Download URL | compliancelayer-0.1.1.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b2a929b751004f7268c2a44fd64c5c5656e01a0101ef1e3cecc6e54d68eb89d
|
|
BLAKE2b-256 checksum How to use checksums |
4bf1e8f8800d0bdca216eb7f11977e0df6749536652c46e1e7c1b5ea5cf05f2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / compliancelayer-0.1.1-py3-none-any.whl
| Download URL | compliancelayer-0.1.1-py3-none-any.whl |
|---|---|
| Size | 20.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3beed3c2dda02ffff01a9785f636e198d4db127df9b8a1ccab95be9ba745589
|
|
BLAKE2b-256 checksum How to use checksums |
3ed141e92e293289d9ddc750ca0afb2c11b4e91b18f62cb6615b9cad23a0f0b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for compliancelayer 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.