
Rajinder Singh
Deep Learning Researcher
Published Feb 03, 2025
Updated Jan 23, 2025 · min read

"Frustrating captcha..."

The eternal struggle - CAPTCHAs try to tell humans and bots apart
While CAPTCHAs protect websites from spam, they can block legitimate automation for:

Your Capsolver dashboard - where API keys live
Install requirements:
pip install requests
Get your API key:
clientKey
How the CAPTCHA solving process works
Complete code walkthrough:
# pip install requests
import requests
import time
# TODO: set your config
api_key = "YOUR_API_KEY" # your api key of capsolver
site_key = "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_kl-" # site key of your target site
site_url = "" # page url of your target site
def capsolver():
payload = {
"clientKey": api_key,
"task": {
"type": 'ReCaptchaV3TaskProxyLess',
"websiteKey": site_key,
"websiteURL": site_url,
"pageAction": "login",
}
}
res = requests.post("https://api.capsolver.com/createTask", json=payload)
resp = res.json()
task_id = resp.get("taskId")
if not task_id:
print("Failed to create task:", res.text)
return
print(f"Got taskId: {task_id} / Getting result...")
while True:
time.sleep(1) # delay
payload = {"clientKey": api_key, "taskId": task_id}
res = requests.post("https://api.capsolver.com/getTaskResult", json=payload)
resp = res.json()
status = resp.get("status")
if status == "ready":
return resp.get("solution", {}).get('gRecaptchaResponse')
if status == "failed" or resp.get("errorId"):
print("Solve failed! response:", res.text)
return
token = capsolver()
print(token)
Common CAPTCHA types you'll encounter
| Task Type |
|---|
| ReCaptchaV2Task / ReCaptchaV2TaskProxyless |
| ReCaptchaV3Task / ReCaptchaV3TaskProxyless |
| GeeTestTask / GeeTestTaskProxyless |
| AntiTurnstileTaskProxyless |
| ImageToTextTask |

When your CAPTCHA solution fails...
Common Fixes:

Rajinder Singh
Deep Learning Researcher
Making CAPTCHA solving more reliable in automated workflows.
ABOUT THE AUTHOR
Find CapSolver MCP in the Official MCP Registry, install version 0.1.3 with uvx or pip, configure a local client, and verify the stdio tools.

Add CAPTCHA tools to Pydantic AI using the official CapSolver adapter, test tool execution locally, and handle typed inputs and structured solver results.
