Skip to main content

Official Python SDK for the AutoData ML data preparation pipeline API

Project description

AutoData Python Client

Official Python SDK for the AutoData ML data preparation pipeline API.

Installation

pip install autodata-client

Or install from source:

git clone https://github.com/datatoolpack/autodata-client
cd autodata-client
pip install .

Quick Start

from autodata import AutoDataClient

client = AutoDataClient(
    api_key="dtpk_YOUR_API_KEY",
    base_url="https://autodata.datatoolpack.com",
)

result = client.process(
    file_path="data.csv",
    target_columns=["price"],
    output_rows=20000,
)
print(result["files"])
# [{'name': 'dsg.csv', 'url': '/download/...', 'size': 1048576, 'description': '...'}]

Get your API key from the AutoData dashboard → API Keys tab.


Reference

AutoDataClient(api_key, base_url, timeout)

Parameter Type Default Description
api_key str required API key starting with dtpk_
base_url str "https://autodata.datatoolpack.com" Server URL (no trailing slash)
timeout int 120 Request timeout in seconds

client.process(...) — Upload & run pipeline

result = client.process(
    file_path="data.csv",           # Path to input CSV
    target_columns=["price"],       # y-column(s) for ML
    output_rows=20000,              # Target row count in output
    tools={                         # Toggle pipeline steps (all optional)
        "anomaly": False,           # Anomaly detection (off by default)
        "dtc": True,                # Data Type Conversion
        "mdh": True,                # Missing Data Handler
        "cds": True,                # Column Scaling
        "dsm": True,                # Data Split Manager
        "dsg": True,                # Synthetic Data Generator
    },
    advanced_params={               # Fine-grained parameters (all optional)
        "excluded_columns": ["id"], # Columns to drop before processing
        "text_mode": 0,             # 0=none, 1=neural, 2=tfidf
        "text_cleaning": True,      # Clean text before encoding
        "zscore_limit": 3.0,        # Z-score outlier threshold
        "dsg_mode": "copula",       # "copula" or "gan"
        "similarity_p": 95,         # Similarity percentile for DSG
    },
    wait=True,                      # Block until complete (default True)
    poll_interval=2,                # Status poll interval in seconds
    download_path="./outputs/",     # Where to save files (default auto)
    output_preferences=["dsg.csv"], # Which files to download (default all)
    compressed=True,                # Download as ZIP (default True)
)

Returns a dict:

{
    "session_id": "abc123...",
    "status": "completed",
    "files": [
        {"name": "dsg.csv", "url": "/download/.../dsg.csv", "size": 2097152, "description": "Synthetic data"},
        {"name": "dsm_train.csv", ...},
        ...
    ],
    "row_count": 20000,
    "duration_seconds": 42.1,
}

Set wait=False to get back immediately with just session_id and status:

result = client.process(file_path="data.csv", target_columns="price", wait=False)
session_id = result["session_id"]

client.get_status(session_id) — Poll progress

status = client.get_status(session_id)
# {
#   "status": "running",           # queued | running | completed | error | cancelled
#   "message": "Running MDH...",
#   "current_step": 3,
#   "total_steps": 6,
#   "progress_percent": 50,
#   "duration_seconds": 15.3,
# }

client.get_result(session_id) — Fetch completed results

result = client.get_result(session_id)
# {"status": "completed", "files": [...], "row_count": ..., "duration_seconds": ...}

client.wait_for_completion(session_id, poll_interval) — Block until done

result = client.wait_for_completion(session_id, poll_interval=3)

Prints live progress to stdout. Raises AutoDataError if processing fails.


client.cancel(session_id) — Cancel a running job

cancelled = client.cancel(session_id)  # True if acknowledged

client.download_results(session_id, ...) — Download output files

path = client.download_results(
    session_id,
    download_path="./my_outputs/",      # Directory to save into
    output_preferences=["dsg.csv"],     # Specific files only (None = all)
    compressed=True,                    # ZIP download (default) or individual files
)
print(f"Saved to {path}")

client.download_file(url, output_path) — Download a single file

client.download_file("/download/abc123.../dsg.csv", "dsg.csv")

client.list_keys() — List API keys

keys = client.list_keys()
# [{"id": "...", "name": "My Key", "prefix": "dtpk_abc123", "created_at": "..."}]

client.get_usage() — Usage statistics

usage = client.get_usage()
# {
#   "daily_credits_used": 500,
#   "daily_credit_limit": 10000,
#   "daily_remaining": 9500,
#   "lifetime_credits_used": 12340,
#   "lifetime_credit_limit": 1000000,
#   "lifetime_remaining": 987660,
#   "daily_request_count": 3,
#   "last_used_at": "2026-04-12T10:30:00Z",
# }

Error Handling

All API errors raise AutoDataError:

from autodata import AutoDataClient, AutoDataError

client = AutoDataClient(api_key="dtpk_...")

try:
    result = client.process("data.csv", target_columns="price")
except AutoDataError as e:
    print(f"API error {e.status_code}: {e}")
except FileNotFoundError as e:
    print(f"File not found: {e}")

AutoDataError attributes:

  • str(e) — human-readable error message from the server
  • e.status_code — HTTP status code (e.g. 401, 429, 500), or None for non-HTTP errors

Advanced Example: Non-blocking with manual polling

import time
from autodata import AutoDataClient, AutoDataError

client = AutoDataClient(api_key="dtpk_...")

# Start job without blocking
job = client.process("large_dataset.csv", target_columns=["churn"], wait=False)
session_id = job["session_id"]
print(f"Job started: {session_id}")

# Poll manually
while True:
    status = client.get_status(session_id)
    print(f"  {status['progress_percent']}% — {status['message']}")
    if status["status"] == "completed":
        break
    elif status["status"] in ("error", "cancelled"):
        raise AutoDataError(f"Job {status['status']}: {status['message']}")
    time.sleep(5)

# Download results
path = client.download_results(session_id, download_path="./outputs/")
print(f"Results saved to {path}")

Requirements

  • Python ≥ 3.8
  • requests ≥ 2.25.0

License

MIT

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

datatoolpack-0.2.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

datatoolpack-0.2.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file datatoolpack-0.2.0.tar.gz.

File metadata

  • Download URL: datatoolpack-0.2.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for datatoolpack-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0d77a002a4068f6c0541f3c1af4960892a9110fd6edd5e9f4de1c0ae42b672ce
MD5 f78646677f6908452a9eb24ceeef7b18
BLAKE2b-256 06a3aa282a50246fd19b001d6dcfd511cb897c3d522d12b70db474416a5b09b6

See more details on using hashes here.

File details

Details for the file datatoolpack-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: datatoolpack-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for datatoolpack-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6bce95cf8705c7164c8fe0c63a0da4b0802c2e1f832aeb3d6e9662d61de79637
MD5 c01fa709d0b8fb630eb40a848c07e0f3
BLAKE2b-256 e2cdfcbeb86577281d6eb3f297f869b7b967f50ad4be79dadb894f114f0b2657

See more details on using hashes here.

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