Skip to main content

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

Project description

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

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_level)

# 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", quantum_vulnerable=True)
for k in keys.data:
    print(k.provider, k.region, k.key_id, k.algorithm)

## 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`                      | Retries on 429/5xx with backoff        |

## Errors

All exceptions extend `PostQError`:

```python
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.

Project details


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.5.0.tar.gz (12.4 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.5.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: postq_sdk-0.5.0.tar.gz
  • Upload date:
  • Size: 12.4 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.5.0.tar.gz
Algorithm Hash digest
SHA256 f9acaf5ecb1df4b40c077dea285b4a268a0ac6fa31c8dc4e3f21802efd3b96f9
MD5 aa0d03f9cd80963e7fc9ec08cc84d2b6
BLAKE2b-256 a1d7d3c2f8b3964ad3377f9f1c618117f7069122e996273914dd5e3cab36e647

See more details on using hashes here.

Provenance

The following attestation bundles were made for postq_sdk-0.5.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.5.0-py3-none-any.whl.

File metadata

  • Download URL: postq_sdk-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ddc5401e11461fc08eb41783133137a0c4463b997a6b399d401a75e75720b51f
MD5 0a38eaeac31663849365b950889e27c4
BLAKE2b-256 6afc1096d78feea7179616c9575eee539aef21f5f30fcf44a6559e69851f5e2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for postq_sdk-0.5.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.

Supported by

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