Skip to main content

postq-sdk

Official PostQ SDK for Python. Submit quantum-risk scans and read results from the PostQ API.

pip install postq-sdk

Quickstart

from postq import PostQ, Finding

pq = PostQ(api_key="pq_live_…")  # or set POSTQ_API_KEY env var

# Submit a scan
result = pq.scans.submit(
    type="url",
    target="example.com",
    risk_score=85,
    risk_level="High",
    findings=[
        Finding(severity="high", title="RSA-2048 public key"),
    ],
)
print(result.url)  # https://app.postq.dev/scans/...

# List recent scans
for scan in pq.scans.list(limit=10):
    print(scan.target, scan.risk_level)

# Iterate every scan with automatic pagination
for scan in pq.scans.iter_all():
    ...

# Fetch a full scan record (HNDL, certificate, TLS, normalized findings)
detail = pq.scans.get(result.id)
print(detail.hndl.severity if detail.hndl else None,
      detail.certificate.days_until_expiry if detail.certificate else None)

# Download the CycloneDX 1.6 CBOM for a scan
cbom = pq.scans.cbom(result.id)  # parsed dict

# Or ask the API to perform and persist a real scan
tls = pq.scans.run_url(target="example.com")
aws = pq.scans.run_cloud(
    provider="aws",
    target="123456789012",
    aws={"regions": ["us-east-1"]},
)

Assets and keys (0.3.0+)

# Browse your cryptographic inventory
assets = pq.assets.list(provider="aws", risk="HIGH", limit=50)
for a in assets.data:
    print(a.name, a.algorithm, a.risk)

# Or stream every asset
for a in pq.assets.iter_all(environment="production"):
    ...

# Browse keys discovered by cloud scans
keys = pq.keys.list(algorithm="RSA", risk="High")
for k in keys.data:
    print(k.provider, k.region, k.external_id, k.algorithm)

Hybrid signing and multicloud Vault

pq.vault.put_settings(
    default_kek_provider="gcp-kms",
    gcp={
        "kekKeyName": "projects/acme/locations/global/keyRings/postq/cryptoKeys/vault-kek",
        "keyRingName": "projects/acme/locations/us-east1/keyRings/postq-signing",
        "protectionLevel": "HSM",
    },
)
key = pq.hybrid_keys.create(
    name="release-signing",
    algorithm="mldsa65+ecdsa-p256",
    kek_provider="gcp-kms",
    key_provider="gcp-kms",
)
signature = pq.sign(key_id=key.id, payload="release manifest")
assert pq.verify(
    public_key=key.public_key,
    payload="release manifest",
    signature=signature.signature,
).ok

Configuration

Argument Default Notes
api_key $POSTQ_API_KEY pq_live_… from your dashboard
base_url https://api.postq.dev Override for staging or self-hosted
timeout 30.0 Per-request timeout in seconds
max_retries 3 Idempotent-request retries on 429/5xx

POST operations are never automatically replayed because they can create keys, signatures, scans, policies, or Ledger entries.

Errors

All exceptions extend PostQError:

from postq import PostQ, PostQAuthError, PostQRateLimitError

try:
    pq.scans.list()
except PostQAuthError:
    print("bad API key")
except PostQRateLimitError:
    print("slow down")
Exception When
PostQConfigError Missing/invalid constructor input
PostQAuthError 401 — bad, revoked, or expired key
PostQNotFoundError 404
PostQRateLimitError 429
PostQServerError 5xx
PostQNetworkError DNS, connection refused, timeout
PostQError Base class

Requirements

  • Python 3.9+
  • Single dependency: requests

License

MIT — see LICENSE.

Metadata

Release files for postq-sdk 0.6.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 postq-sdk 0.6.0
File Size Uploaded
postq_sdk-0.6.0.tar.gz 14.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for postq-sdk 0.6.0
File Interpreter ABI Platform
postq_sdk-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 30.9 kB

Release files / postq_sdk-0.6.0.tar.gz

Download URL postq_sdk-0.6.0.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cad9f90d668ea9441cb1dba7e659a3dc004f82a41b1e6493c92e7b32bf5bb86b
BLAKE2b-256 checksum
How to use checksums
26eafaa2f8c128e4470686f07e699379ac9db1d517c48083ac2fb991adabecf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 17, 2026.

Transparency log

Release files / postq_sdk-0.6.0-py3-none-any.whl

Download URL postq_sdk-0.6.0-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3135bd815902d2289bdcb4e88f4d0b9132a13ae519c52bc82c40db09b7fc3d6f
BLAKE2b-256 checksum
How to use checksums
946f3451e91f3f031c7dfb3d8c5ed79f0557c5fa15103a513fd3bf6382975b5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.2.0

2 release files

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