Skip to main content

Python SDK for the Mindcase Developer API

Project description

Mindcase Python SDK

Official Python SDK for the Mindcase Developer API — programmatic access to 34+ data collection agents across Instagram, LinkedIn, Amazon, YouTube, Google Maps, and more.

Installation

pip install mindcase

Quick Start

from mindcase import MindcaseClient

client = MindcaseClient("mk_live_...")

# List available agent groups
groups = client.list_groups()
# ['instagram', 'linkedin', 'amazon', 'youtube', ...]

# List agents in a group
agents = client.list_agents("instagram")

# Run an agent and wait for results
results = client.run_and_wait(
    "instagram", "profile-scraper",
    usernames=["nike", "adidas"]
)

for row in results["data"]:
    print(row["Username"], row["Followers"])

Authentication

Get your API key from the Mindcase Dashboard under Developer > API Keys.

client = MindcaseClient("mk_live_your_key_here")

Usage

Discover Agents

# List all groups
groups = client.list_groups()

# List agents in a group
agents = client.list_agents("linkedin")

# Get agent details and parameter schema
agent = client.get_agent("linkedin", "profile-scraper")
print(agent["parameters"])  # See required/optional params

Run Agents

# Fire and forget — returns immediately with a job ID
job = client.run("amazon", "product-scraper", searchTerms=["laptop stand"])
print(job["job_id"])

# Run and wait for results (polls automatically)
results = client.run_and_wait(
    "amazon", "product-scraper",
    searchTerms=["laptop stand"],
    timeout=300,          # max wait in seconds (default 300)
    poll_interval=3.0,    # seconds between polls (default 3)
)
print(f"Got {results['row_count']} rows")

Job Management

# Check job status
job = client.get_job("job_abc123")
print(job["status"])  # queued, running, completed, failed, cancelled

# Get results for a completed job
results = client.get_results("job_abc123")

# Cancel a running job
client.cancel_job("job_abc123")

# List your recent jobs
jobs = client.list_jobs(limit=10)
jobs = client.list_jobs(status="completed")

Check Credits

credits = client.get_credits()
print(f"{credits} credits remaining")

Error Handling

from mindcase import (
    MindcaseError,
    AuthenticationError,
    InsufficientCreditsError,
    RateLimitError,
    NotFoundError,
    ValidationError,
)

try:
    results = client.run_and_wait("instagram", "profile-scraper", usernames=["nike"])
except AuthenticationError:
    print("Invalid API key")
except InsufficientCreditsError:
    print("Not enough credits — top up at mindcase.co")
except RateLimitError:
    print("Too many requests — retry after 60s")
except NotFoundError:
    print("Agent not found")
except ValidationError as e:
    print(f"Bad parameters: {e.message}")
except MindcaseError as e:
    print(f"API error {e.status_code}: {e.message}")

Configuration

client = MindcaseClient(
    api_key="mk_live_...",
    base_url="https://api.mindcase.co/api/v1",  # default
    timeout=30,                                   # request timeout in seconds
)

Links

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

mindcase-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

mindcase-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file mindcase-0.1.0.tar.gz.

File metadata

  • Download URL: mindcase-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for mindcase-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c6b140af3fcfaf9b03e8c30c446581299d895bebc77020b9bdb4008737aa5c4c
MD5 1303112b734c635d28905d3f7a0d3d8a
BLAKE2b-256 64f8651c11d23e1835b1d8580a7376125c9824c788f6ee8d0a02061913bbc694

See more details on using hashes here.

File details

Details for the file mindcase-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mindcase-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for mindcase-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28946e26975cce1543fc511d3dd774bbada32d04b0b65fc939a42f3225a62830
MD5 b1094411ffc41a4939694d8d514b031e
BLAKE2b-256 aa9d680e3b1486095b7a68065e731ae7ba9db840cc60d7e936970ab72641ec14

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