Python SDK for the Mindcase Developer API
Project description
Mindcase Python SDK
Official Python SDK for the Mindcase Developer API — programmatic access to 30+ data collection agents across Instagram, LinkedIn, YouTube, Amazon, Google Maps, and more.
Installation
pip install mindcase
Quick Start
from mindcase import Mindcase
client = Mindcase(api_key="mk_live_...")
# Or set MINDCASE_API_KEY env var and omit api_key
# Run an agent and get results
results = client.run("instagram/profiles", params={
"usernames": ["nike", "adidas"]
})
for row in results:
print(f"{row['Username']}: {row['Followers']} followers")
API Reference
Discovery
# List all agents
agents = client.agents.list()
# Filter by platform
agents = client.agents.list("instagram")
# Get agent details + required params
agent = client.agents.get("instagram/profiles")
print(agent.required_params)
Run Agents
# Sync — blocks until results
results = client.run("instagram/profiles", params={
"usernames": ["nike"]
})
# Async — returns immediately
job = client.run_async("instagram/profiles", params={
"usernames": ["nike"]
})
print(job.id, job.status)
Manage Jobs
jobs = client.jobs.list()
job = client.jobs.get("job_abc123")
results = client.jobs.results("job_abc123")
client.jobs.cancel("job_abc123")
Credits
balance = client.credits()
Error Handling
from mindcase import (
Mindcase,
AuthenticationError,
InsufficientCreditsError,
RateLimitError,
ValidationError,
NotFoundError,
)
try:
results = client.run("instagram/profiles", params={
"usernames": ["nike"]
})
except AuthenticationError:
print("Invalid API key")
except InsufficientCreditsError:
print("Not enough credits")
except RateLimitError:
print("Too many requests")
Configuration
client = Mindcase(
api_key="mk_live_...", # or MINDCASE_API_KEY env var
base_url="https://api.mindcase.co/api/v1", # default
timeout=30, # HTTP timeout (seconds)
poll_interval=3.0, # polling interval (seconds)
run_timeout=300, # max wait for run() (seconds)
)
Documentation
Full docs: docs.mindcase.co
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.3.0.tar.gz
(6.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mindcase-0.3.0.tar.gz.
File metadata
- Download URL: mindcase-0.3.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aee1b61b95c6f8fbf78f6b0b7ac60e958b60204df0937f316862aa8bfa0fff97
|
|
| MD5 |
fadc74d41521327c920dc6fe104b62ba
|
|
| BLAKE2b-256 |
0a77235308a21cf33fa240a14f768f5159d084593f7013f66035fb97adfdc5b9
|
File details
Details for the file mindcase-0.3.0-py3-none-any.whl.
File metadata
- Download URL: mindcase-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68eeb8f000440cd88279595dea7ce5d3ce11687da6cbb02ec4a9e96ca176839e
|
|
| MD5 |
15c47c20102975a7ce5759c432f2ec7f
|
|
| BLAKE2b-256 |
20a9859c26a22b4eca4f3b9651d2bb4ba90a0db45f79a3f9d2f39f38afcf9abe
|