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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

postq_sdk-0.6.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

postq_sdk-0.6.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file postq_sdk-0.6.0.tar.gz.

File metadata

  • Download URL: postq_sdk-0.6.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for postq_sdk-0.6.0.tar.gz
Algorithm Hash digest
SHA256 cad9f90d668ea9441cb1dba7e659a3dc004f82a41b1e6493c92e7b32bf5bb86b
MD5 11e7ca13372bcd6601fba741bf874065
BLAKE2b-256 26eafaa2f8c128e4470686f07e699379ac9db1d517c48083ac2fb991adabecf4

See more details on using hashes here.

Provenance

The following attestation bundles were made for postq_sdk-0.6.0.tar.gz:

Publisher: publish-pypi.yml on PostQDev/postq-sdk-all

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file postq_sdk-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: postq_sdk-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for postq_sdk-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3135bd815902d2289bdcb4e88f4d0b9132a13ae519c52bc82c40db09b7fc3d6f
MD5 3237f430537b4ba1713c0c82c6a118c2
BLAKE2b-256 946f3451e91f3f031c7dfb3d8c5ed79f0557c5fa15103a513fd3bf6382975b5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for postq_sdk-0.6.0-py3-none-any.whl:

Publisher: publish-pypi.yml on PostQDev/postq-sdk-all

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 files

0.5.0

2 files

0.4.0

2 files

0.2.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page