Python CAPTCHA Solving API: Getting Started with DeathByCaptcha
Python is the most popular language for web scraping, automation, and data collection, and DeathByCaptcha's python captcha api makes integrating CAPTCHA solving straightforward.
This guide covers installation, basic usage, and advanced patterns.
Installation
pip install deathbycaptcha
Quick Start
import deathbycaptcha
client = deathbycaptcha.SocketClient("username", "password")
with open("captcha.png", "rb") as f:
cid, solution = client.decode(f.read(), timeout=60)
if solution:
print(f"Solved: {solution}")
Supported Captcha Types
| Type | Method |
|---|---|
| Image captcha | client.decode(image_data) |
| reCAPTCHA v2 | client.decode({"googlekey": key, "pageurl": url}, type=4) |
| reCAPTCHA v3 | client.decode({"googlekey": key, "pageurl": url}, type=5) |
| Cloudflare Turnstile | client.decode({"sitekey": key, "pageurl": url}, type=13) |
| GeeTest | client.decode({"gt": gt, "challenge": challenge, "pageurl": url}, type=6) |
| DataDome | client.decode({"pageurl": url, "captcha_url": captcha_url}, type=12) |
HTTP API Alternative
import requests
url = "https://api.deathbycaptcha.com/api/captcha/solve"
response = requests.post(url, json={
"username": "user", "password": "pass",
"captcha": {"type": 1, "image": base64_image}
})
Error Handling
try:
cid, solution = client.decode(image_data, timeout=60)
except deathbycaptcha.AccessDeniedException:
print("Invalid credentials")
except deathbycaptcha.SolveTimeoutException:
print("Solve timed out")
Performance Tips
- Reuse the client instance across requests.
- Use callback URLs for high-throughput workflows.
- For bulk operations, send captchas in parallel using
concurrent.futures.

Hindi
English
Spanish
Russian
Chinese
French
Arabic
Bengali
Indonesian
Portuguese
कॉम, 