Skip to main content

kloakd-sdk — Official Python SDK for KLOAKD

PyPI Python License: MIT

The KLOAKD SDK gives Python developers typed access to all 7 KLOAKD modules. Modules compose like Unix pipes — the artifact output of one becomes the input to the next, eliminating redundant fetches.

Installation

pip install kloakd-sdk

Requires Python 3.9+ and httpx>=0.27 (installed automatically).

Quickstart

from kloakd import Kloakd

client = Kloakd(
    api_key="sk-live-...",
    organization_id="your-org-id",
)

# Step 1: Fetch with anti-bot bypass
fetch = client.evadr.fetch("https://books.toscrape.com")
print(f"Fetched via tier {fetch.tier_used}")

# Step 2: Crawl site hierarchy — reuse the Evadr artifact, no double-fetch
crawl = client.webgrph.crawl(
    "https://books.toscrape.com",
    max_depth=2,
    session_artifact_id=fetch.artifact_id,
)
print(f"Found {crawl.total_pages} pages")

# Step 3: Extract structured data — reuse the Evadr artifact again
data = client.kolektr.page(
    "https://books.toscrape.com",
    schema={"title": "css:h3 a", "price": "css:p.price_color"},
    fetch_artifact_id=fetch.artifact_id,
)
for book in data.records[:3]:
    print(book)

The 7 Modules

Namespace Module Purpose
client.evadr Evadr Anti-bot bypass (5-tier escalation)
client.webgrph Webgrph Site mapping & BFS crawl
client.skanyr Skanyr Site knowledge store: sites, resources, search, history
client.nexus Nexus 5-layer strategy engine
client.parlyr Parlyr Conversational NLP → extraction intent
client.fetchyr Fetchyr RPA, authentication, MFA, workflows
client.kolektr Kolektr Structured data extraction

Artifact Chaining

Artifacts are the composition primitive — the output of one module becomes the input to another:

evadr.fetch()    → artifact_id (FETCHED_CONTENT)
  └─→ kolektr.page(fetch_artifact_id=...)       # skip re-fetch
  └─→ webgrph.crawl(session_artifact_id=...)    # authenticated crawl

fetchyr.authenticate() → artifact_id (AUTHENTICATED_SESSION)
  └─→ evadr.fetch(session_artifact_id=...)      # authenticated fetch
  └─→ webgrph.crawl(session_artifact_id=...)

webgrph.crawl()  → crawl_id (SITE_HIERARCHY)
  └─→ skanyr.site_from_crawl(crawl_id)          # into the site store

Async Client

from kloakd import AsyncKloakd

client = AsyncKloakd(api_key="sk-live-...", organization_id="your-org-id")

async def main():
    fetch = await client.evadr.fetch("https://books.toscrape.com")
    data  = await client.kolektr.page("https://books.toscrape.com",
                                       fetch_artifact_id=fetch.artifact_id)

    # SSE stream
    async for event in client.webgrph.crawl_stream("https://books.toscrape.com"):
        print(event.type, event.url)

Error Handling

from kloakd.errors import KloakdError, RateLimitError, AuthenticationError
import time

try:
    result = client.evadr.fetch("https://example.com")
except RateLimitError as e:
    time.sleep(e.retry_after)
except AuthenticationError:
    # Rotate API key
    raise
except KloakdError as e:
    print(f"Error {e.status_code}: {e.message}")

Error types:

Class HTTP Cause
AuthenticationError 401 Invalid or expired API key
NotEntitledError 403 Plan doesn't include this module
PaymentRequiredError 402 The plan's last payment failed
QuotaExceededError 429 GB allocation and top-ups used up (gb_exhausted; not retried)
RateLimitError 429 Request rate exceeded (has retry_after seconds; retried)
UpstreamError 502 Target site unreachable
BillingUnavailableError 503 Usage could not be checked; retried after retry_after
JobFailedError / JobTimeoutError — A fetch job or crawl failed, or was still running when the wait ran out
ApiError 4xx/5xx Any other API error

Long fetches: the API answers a synchronous fetch within about 85 seconds; one still running then continues as a job (HTTP 202). evadr.fetch follows it to its result (poll_interval, poll_timeout).

Crawls and pages

crawl = client.webgrph.crawl("https://example.com")   # waits, then loads every page
all_pages = crawl.pages
page = client.webgrph.get_crawl_pages(crawl.crawl_id, limit=100)   # one page, by cursor
all_records = client.kolektr.page_all("https://example.com")

Fetchyr — RPA & Authentication

# Store credentials once, then log in and produce a reusable session
client.fetchyr.store_credentials("app", username="user@example.com", password="secret")
session = client.fetchyr.authenticate("app", "https://app.example.com/login")

# Detect and handle MFA
mfa = client.fetchyr.detect_mfa("https://app.example.com/mfa",
                                  session_artifact_id=session.artifact_id)
if mfa.mfa_detected:
    challenge = client.fetchyr.submit_mfa(mfa.challenge_id, "123456")

# Detect forms, run workflows, deduplicate records
forms  = client.fetchyr.detect_forms("https://example.com/signup")
seen   = client.fetchyr.check_duplicate("https://example.com/item/1")

License

MIT

Metadata

Release files for kloakd-sdk 0.3.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 kloakd-sdk 0.3.0
File Size Uploaded Provenance Actions
kloakd_sdk-0.3.0.tar.gz 32.7 kB With provenance Details for kloakd_sdk-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kloakd-sdk 0.3.0
File Interpreter ABI Platform Actions
kloakd_sdk-0.3.0-py3-none-any.whl Python 3 none any Details for kloakd_sdk-0.3.0-py3-none-any.whl

Total release size: 71.1 kB

Release files / kloakd_sdk-0.3.0.tar.gz

Download URL kloakd_sdk-0.3.0.tar.gz
Size 32.7 kB
Tags Source
SHA-256 checksum
How to use checksums
07db5f8d6025d669126e447412b62fb22e5f0111d6f2bfbc18a22562217a3afd
BLAKE2b-256 checksum
How to use checksums
919c3e514cc031f318ffb5397358a578da10ed01576d46c2a2508a1fa5993ed9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 27, 2026.

Transparency log

Release files / kloakd_sdk-0.3.0-py3-none-any.whl

Download URL kloakd_sdk-0.3.0-py3-none-any.whl
Size 38.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b6db38e773fe3e28e437047c55cdf5b91382f0765dfb22488708844818a5559
BLAKE2b-256 checksum
How to use checksums
9d50cb0abeab993eb8255adbf504d9324aa82c33358dee5bfa70e017de973467
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 27, 2026.

Transparency log

Security for kloakd-sdk 0.3.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kloakd_sdk-0.3.0.tar.gz

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 Oct 27, 2026.

Transparency log

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.

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