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:
    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")
for agent in agents:
    print(agent.name, agent.slug, agent.credits_per_row)

# Get agent details and parameter schema
agent = client.get_agent("linkedin", "profile-scraper")
print(agent.name)             # "LinkedIn Profile Scraper"
print(agent.required_params)  # {'profileUrls': Parameter(...)}
print(agent.credits_per_row)  # 2

Run Agents

# Run an agent — returns immediately with a Job object
job = client.run("amazon", "product-scraper", searchTerms=["laptop stand"])
print(job.job_id)   # "job_abc123"
print(job.status)   # "queued"

# Then poll for results manually
results = client.wait_for_results(job.job_id)
# Or run and wait for results in one call (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")
for row in results:
    print(row["Title"], row["Price"])

Data Query Agents (VC, Apollo, Restaurant)

Some agents query structured databases using filters instead of URLs:

# Indian startup funding data
results = client.run_and_wait("tools", "vc-data",
    filters={"sector": "AI", "city": "Bangalore", "year": 2025},
    limit=50,
)
for row in results:
    print(row["Company"], row["Stage"], row["Amount (USD)"])

# Product pricing across platforms (free — 0 credits)
results = client.run_and_wait("tools", "apollo-data",
    filters={"product": "paracetamol", "platform": "1mg"},
    limit=20,
)

# Restaurant & menu data (Zomato/Swiggy)
results = client.run_and_wait("tools", "restaurant-data",
    filters={"city": "Mumbai", "cuisine": "Italian", "sort_by": "rating"},
    limit=25,
)

Use GET /agents/tools/{slug} to see all available filter keys for each agent.

Job Management

# Check job status
job = client.get_job("job_abc123")
print(job.status)      # queued, running, completed, failed, cancelled
print(job.is_done)     # True if completed
print(job.is_running)  # True if queued or running

# Get results for a completed job
results = client.get_results("job_abc123")
print(results.columns)              # ['Title', 'Price', ...]
print(results.to_list("Title"))     # ['Laptop Stand', ...]
print(results[0])                   # first row as dict

# 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.2.1.tar.gz (6.6 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.2.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mindcase-0.2.1.tar.gz
Algorithm Hash digest
SHA256 79b92d1f81a2dc828b441abcee6a96f386dcd58df35a31320f2bfcd749517fa6
MD5 06f221e20557b62fb68da7d75c39aac6
BLAKE2b-256 173a7fd93706672f5c8ef208f15033ae30a9d9c2421fecf0c83a2310356a55d6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mindcase-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 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.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 558dfc16eebba3e95d85f64b151980dec5a44b497817dd3aac138a599e4b4fb7
MD5 b0524933cca0d9c04000c0121edca72b
BLAKE2b-256 f23836f23e3d3e363f08067cb60f8f6d97bdf93a97342a68098324662bd0fd54

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