Pentify
SDKs

Python

pentify on PyPI — typed client generated from the Pentify OpenAPI 3.1 spec. Sync and async surfaces in one package. Python 3.9+.

Install

pip install pentify
# or
poetry add pentify
# or
uv add pentify

Client construction

from pentify import Pentify
import os

pentify = Pentify(
    api_key=os.environ["PENTIFY_API_KEY"],
    # optional:
    base_url="https://api.pentify.io/v1",
    timeout=30.0,
    max_retries=5,
)

Async client

from pentify import AsyncPentify

async with AsyncPentify(api_key=os.environ["PENTIFY_API_KEY"]) as pentify:
    scan = await pentify.scans.create(target="example.com", scan_type="quick")

The context manager closes the underlying httpx.AsyncClient cleanly.

Namespaced API

NamespaceSurface
pentify.scanslist, create, retrieve, cancel
pentify.targetslist, create, retrieve, verify, delete
pentify.reportsretrieve, pdf_url, list_findings
pentify.usageretrieve
pentify.webhookslist, create, retrieve, delete, verify

Pagination

for page in pentify.scans.list(limit=100).pages():
    for s in page.data:
        print(s.id, s.status)

Errors

from pentify import PentifyError, InsufficientTokensError, RateLimitedError

try:
    pentify.scans.create(target="example.com", scan_type="quick")
except InsufficientTokensError as e:
    print("need", e.required, "have", e.balance, "→", e.top_up_url)
except PentifyError as e:
    print(e.code, e.request_id)

See Errors.

Retry behavior

429, 502, 503, 504 retried with exponential backoff. Honors Retry-After. Disable with max_retries=0.

Webhook verification

event = pentify.webhooks.verify(
    header=request.headers["pentify-signature"],
    raw_body=await request.body(),
    secret=os.environ["PENTIFY_WEBHOOK_SECRET"],
)
if event.type == "scan.completed":
    ...

See Webhooks.