Skip to main content

Atlas Python SDK

The official Python client library for the Atlas API.

Supports both synchronous and asynchronous workflows with full type annotations, automatic idempotency protection, polling helpers, and constant-time webhook signature verification.

Installation

pip install atlascompiler

Authentication

Get your API key from the Atlas Dashboard.

All Atlas SDKs automatically read the ATLAS_API_KEY environment variable:

export ATLAS_API_KEY="atlas_your_api_key_here"

You can also pass your API key directly to the client constructor:

from atlascompiler import AtlasClient

# Option A: Explicit manual API key
client = AtlasClient("atlas_your_api_key_here")

# Option B: Automatically loaded from os.environ["ATLAS_API_KEY"]
# client = AtlasClient()

Usage

Scrape a page

Extract clean Markdown and discovered links from any web page in real-time (sub-1.5s):

response = client.scrape({
    "url": "https://atlas-compiler.com",
    "formats": ["markdown", "links"],
})

if response.status == 200:
    print("Title:", response.metadata.get("title"))
    print("Markdown:\n", response.markdown)

Compile a page

Perform deep semantic AST compilation to extract clean Markdown, structure multi-column tables, and resolve links:

# Automatically generates an execution-scoped UUIDv4 idempotency key if omitted
response = client.compile({"url": "https://docs.github.com/en/rest"})

if response.status == 200:
    print("Compiled Markdown:\n", response.markdown)

Handle asynchronous jobs

For deep crawls or complex pages that return HTTP 202 Accepted, poll for completion:

response = client.compile({"url": "https://docs.github.com/en/rest"})

if response.status == 202:
    job_id = response.value["id"]
    job = client.wait_for_job(job_id, interval_seconds=1.0, max_wait_seconds=60.0)
    results = client.list_job_results(job_id)
    print("Results:", results.value["data"][0]["markdown"])

Asynchronous client (AsyncAtlasClient)

import asyncio
from atlascompiler import AsyncAtlasClient

async def main():
    # Automatically reads ATLAS_API_KEY from environment
    async with AsyncAtlasClient() as client:
        response = await client.compile({"url": "https://docs.github.com/en/rest"})
        if response.status == 200:
            print("Markdown:\n", response.markdown)

asyncio.run(main())

Idempotency Semantics

  • Implicit Execution Safety: For mutation endpoints (compile, cancel_job, bulk_cancel_jobs), an RFC 4122 UUIDv4 is automatically generated when idempotency_key is omitted.
  • Explicit Deterministic Deduplication: When deduplication across distinct attempts is required, pass your custom string:
client.compile({"url": "https://example.com"}, idempotency_key="my-deterministic-key-123")

Error Handling (RFC 9457)

All non-2xx API errors raise AtlasApiError containing the parsed RFC 9457 Problem Details object:

from atlascompiler import AtlasApiError

try:
    client.get_job("job_invalid_id")
except AtlasApiError as e:
    print(f"Error [{e.status}] {e.code}: {e.detail}")
    print(f"Request ID: {e.problem.get('requestId')}")

Webhook Signature Verification

Verify webhook payloads, guard against replay attacks with configurable clock drift tolerance, and support zero-downtime secret rotation:

from atlascompiler import verify_webhook_signature

result = verify_webhook_signature(
    payload=raw_body,  # bytes or str
    headers=request.headers,
    secret=os.getenv("ATLAS_WEBHOOK_SECRET"),
    previous_secret=os.getenv("ATLAS_WEBHOOK_PREVIOUS_SECRET"),  # optional rotation grace
    tolerance_seconds=300,  # 5 minutes
)

if not result.valid:
    print(f"Webhook verification failed: {result.error}")
else:
    event = result.event
    print(f"Received event: {event['type']}")

Configuration Precedence

  1. Explicit constructor arguments (api_key, workspace_id, base_url, timeout)
  2. Ambient environment variables (ATLAS_API_KEY, ATLAS_WORKSPACE_ID, ATLAS_BASE_URL)
  3. Defaults (https://api.atlas-compiler.com, 30.0s timeout)

License

MIT

Metadata

Release files for atlascompiler 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for atlascompiler 1.0.1
File Size Uploaded Provenance Actions
atlascompiler-1.0.1.tar.gz 20.0 kB Without provenance Details for atlascompiler-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for atlascompiler 1.0.1
File Interpreter ABI Platform Actions
atlascompiler-1.0.1-py3-none-any.whl Python 3 none any Details for atlascompiler-1.0.1-py3-none-any.whl

Total release size: 38.1 kB

Release files / atlascompiler-1.0.1.tar.gz

Download URL atlascompiler-1.0.1.tar.gz
Size 20.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b7a0291a312b1284958debe42513d86b9d8c09fbcee2592c399f422dd71a604f
BLAKE2b-256 checksum
How to use checksums
ddb570793e043571a03874cc73c381b484b84b620a766ee98470d10a0e8c1ca6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release files / atlascompiler-1.0.1-py3-none-any.whl

Download URL atlascompiler-1.0.1-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d2fbc6aaf7b6da712139a40d698c91cec29224344e918e4c691a712bfe90985
BLAKE2b-256 checksum
How to use checksums
d0165b66c690467ab7a172d69b33ba68a8da520577e364b735213f5e62c384f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Security for atlascompiler 1.0.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

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