CapBypass Python SDK
Official Python SDK for the CapBypass CAPTCHA solving API.
Features
- ✨ Simple
solve()method with auto-polling (first poll after 1 s, then every 1-3 s) - 🎯 Advanced
createTask()+getTaskResult()for granular control - 💰
getBalance()to check account balance - 🔄 Automatic retry logic for network failures
- 🛡️ Comprehensive error handling
- 📝 Type hints for better IDE support
- 🧪 100% test coverage
Supported CAPTCHA Types
- reCAPTCHA v2 (normal & invisible)
- reCAPTCHA v3
- reCAPTCHA v3 Enterprise
- AWS WAF CAPTCHA
- Cloudflare Turnstile
Installation
pip install capbypass-sdk
Quick Start
from capbypass import CapBypass
# Initialize client
client = CapBypass(api_key="your-api-key")
# Or use environment variable: export CAPBYPASS_API_KEY="your-key"
# Solve CAPTCHA (auto-polling)
solution = client.solve({
"type": "ReCaptchaV2TaskProxyLess",
"websiteURL": "https://example.com",
"websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
})
print(solution["gRecaptchaResponse"])
Advanced Usage
Granular Control
# Create task
task_id = client.createTask({
"type": "ReCaptchaV2TaskProxyLess",
"websiteURL": "https://example.com",
"websiteKey": "site-key"
})
# Poll for result. getTaskResult does not wait by itself: wait 1 second after
# createTask, then 1 to 3 seconds between calls (not faster), until the task is
# ready or failed, and give up after your own deadline.
import time
deadline = time.monotonic() + 120
time.sleep(1)
while True:
result = client.getTaskResult(task_id)
if result["status"] == "ready":
print(result["solution"])
break
if result["status"] == "failed":
raise RuntimeError(result.get("errorDescription", "Task failed"))
if time.monotonic() > deadline:
raise TimeoutError("Task not ready in time")
time.sleep(2)
Check Balance
balance = client.getBalance()
print(f"Balance: ${balance:.4f}")
Cloudflare Turnstile
websiteURL and websiteKey are required. action (1 to 32 characters of A-Z a-z 0-9 _ -) and cData (1 to 255 characters of the same set) are optional and replace the page's data-action / data-cdata. The solution holds token (the cf-turnstile-response value) and timing.solveMs; Turnstile returns no userAgent.
solution = client.solve({
"type": "TurnstileTaskProxyLess",
"websiteURL": "https://example.com/login",
"websiteKey": "0x4AAAAAAAxxxxxxxxxxxxxx",
})
token = solution["token"]
With your own proxy (TurnstileTask requires one): a single http(s) URL in the proxy field, no socks:
solution = client.solve({
"type": "TurnstileTask",
"websiteURL": "https://example.com/login",
"websiteKey": "0x4AAAAAAAxxxxxxxxxxxxxx",
"action": "login",
"cData": "session-42",
"proxy": "http://user:pass@host:port",
})
With Proxy
Every task type with a proxy (the non-ProxyLess variants) takes it as one string in the proxy field. The SDK sends it unchanged; the API validates it when the task is created, before anything is billed. Supported protocols: http, https, socks4, socks5 (http when omitted). Some task types accept http(s) proxies only, as their page says (Turnstile and Cloudflare, for example).
| Form | Pattern |
|---|---|
| URL | protocol://user:pass@host:port |
| Colon | host:port:user:pass or host:port |
| Protocol + colon | protocol:host:port:user:pass or protocol:host:port |
Send only the proxy itself: no spaces or other text (a whole line copied from a proxy list is refused), a port from 1 to 65535, and percent-encode any @, /, :, # or ? in the user or password of the URL form. The host must be public. A malformed proxy is refused with ERROR_PROXY_FORMAT (ValidationError) and an internal or reserved address with ERROR_BLOCKED_TARGET (ValidationError). See Proxy Format in the API reference.
solution = client.solve({
"type": "ReCaptchaV2Task",
"websiteURL": "https://example.com",
"websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
"proxy": "http://username:password@proxy.example.com:8080",
})
Error Handling
from capbypass import CapBypass
from capbypass.errors import (
AuthenticationError,
InsufficientBalanceError,
TimeoutError,
)
try:
solution = client.solve(task)
except AuthenticationError:
print("Invalid API key")
except InsufficientBalanceError:
print("Insufficient balance")
except TimeoutError:
print("Task timed out")
Documentation
📚 Core Documentation
🔧 Advanced Guides
- Proxy Configuration — HTTP, HTTPS, SOCKS5 proxy support with rotation strategies
- Error Handling — Retry strategies, circuit breakers, production alerting
- Performance Optimization — Concurrent solving, connection pooling, token caching
- Production Deployment — Kubernetes, AWS Lambda, monitoring, security
🔄 Migration
- Migrating from Capsolver — 100% API compatible, drop-in replacement
Examples
Basic Examples
See examples/ directory for complete runnable examples:
- recaptcha_v2.py - reCAPTCHA v2 solving
- recaptcha_v3.py - reCAPTCHA v3 solving
- aws_waf.py - AWS WAF CAPTCHA solving
- turnstile.py - Cloudflare Turnstile solving
Advanced Examples
Full integration examples in the documentation:
- E-commerce checkout automation
- Social media automation
- Web scraping with CAPTCHA handling
- Microservice integration patterns
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run linter
ruff check .
# Run type checker
mypy src/
License
MIT
Support
Metadata
Release files for capbypass-sdk 1.0.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| capbypass_sdk-1.0.14.tar.gz | 13.2 kB | Without provenance | Details for capbypass_sdk-1.0.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| capbypass_sdk-1.0.14-py3-none-any.whl | Python 3 | none | any | Details for capbypass_sdk-1.0.14-py3-none-any.whl |
Total release size: 24.5 kB
Release files / capbypass_sdk-1.0.14.tar.gz
| Download URL | capbypass_sdk-1.0.14.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0de2ca9fd5fcd1d7fcb6319618acc3221ae90a0cd948f418b057e284420fdc6
|
|
BLAKE2b-256 checksum How to use checksums |
45e82a8729ac058bb5e22015b38c47c34a299d73573fac2ae911e1a2e7bc27dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / capbypass_sdk-1.0.14-py3-none-any.whl
| Download URL | capbypass_sdk-1.0.14-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e8746c7e82f94fb90e70e3be64203d7ba39beb5f850eabdb602096e7f4524dde
|
|
BLAKE2b-256 checksum How to use checksums |
c46d05d018500a158e94f70e2668d2a1f1d1b5710839c736ebb71473e7f365a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for capbypass-sdk 1.0.14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.