Python
Official CapBypass SDK for Python
Installation
pip install capbypass-sdkpoetry add capbypass-sdkRequirements: Python 3.8 or later.
Quick Start
from capbypass import CapBypass
client = CapBypass(
api_key="YOUR_API_KEY",
base_url="https://api.capbypass.pro",
)
# One-step solve (recommended)
solution = client.solve({
"type": "ReCaptchaV3TaskProxyLess",
"websiteURL": "https://example.com",
"websiteKey": "6LdyC2cUAAAAACGuDKpXeDorzUDWXmdqeg-xy696",
"pageAction": "login",
})
print("Token:", solution["gRecaptchaResponse"])Constructor Options
client = CapBypass(
api_key="YOUR_API_KEY", # Required (or set CAPBYPASS_API_KEY env var)
base_url="https://api.capbypass.pro", # API base URL
developer_key="DEV_KEY", # Optional, for affiliate tracking
)| Option | Type | Default | Description |
|---|---|---|---|
api_key | str | CAPBYPASS_API_KEY env | Your API key |
base_url | str | - | API base URL |
developer_key | str | CAPBYPASS_DEVELOPER_KEY env | Affiliate developer key |
Methods
solve(task, timeout=120) - One-Step Solve
Recommended approach
Use solve() for most integrations. It handles task creation and polling automatically, so you don't need to manage the polling loop yourself.
Creates a task and polls until completion.
solution = client.solve({
"type": "ReCaptchaV3TaskProxyLess",
"websiteURL": "https://example.com",
"websiteKey": "6LdyC2cUAAAAACGuDKpXeDorzUDWXmdqeg-xy696",
"pageAction": "login",
}, timeout=120)createTask(task) - Create Task
Returns a task ID for manual polling.
task_id = client.createTask({
"type": "AntiAwsWafTaskProxyLess",
"websiteURL": "https://example.com",
})getTaskResult(task_id) - Get Result
Poll for a task's result.
result = client.getTaskResult(task_id)
if result["status"] == "ready":
print(result["solution"])
elif result["status"] == "processing":
# Still working, poll again
passgetBalance() - Check Balance
balance = client.getBalance()
print(f"Balance: ${balance}")getPricing() - Get Pricing
Public endpoint, no API key required.
pricing = client.getPricing()
# [{"task_type": "ReCaptchaV3TaskProxyLess", "user_cost": 0.0006, "status": "active"}, ...]Task Types
from capbypass import TaskType
TaskType.RECAPTCHA_V2_TASK # "ReCaptchaV2Task"
TaskType.RECAPTCHA_V2_TASK_PROXYLESS # "ReCaptchaV2TaskProxyLess"
TaskType.RECAPTCHA_V3_TASK # "ReCaptchaV3Task"
TaskType.RECAPTCHA_V3_TASK_PROXYLESS # "ReCaptchaV3TaskProxyLess"
TaskType.RECAPTCHA_V3_ENTERPRISE_TASK # "ReCaptchaV3EnterpriseTask"
TaskType.RECAPTCHA_V3_ENTERPRISE_TASK_PROXYLESS # "ReCaptchaV3EnterpriseTaskProxyLess"
TaskType.ANTI_AWS_WAF_TASK # "AntiAwsWafTask"
TaskType.ANTI_AWS_WAF_TASK_PROXYLESS # "AntiAwsWafTaskProxyLess"
TaskType.GEETEST_TASK # "GeetestTask"
TaskType.GEETEST_TASK_PROXYLESS # "GeetestTaskProxyLess"```
## Error Handling
The SDK raises typed exceptions:
```python
from capbypass.errors import (
CapBypassError,
AuthenticationError,
InsufficientBalanceError,
TimeoutError,
SolverError,
)
try:
solution = client.solve(task)
except AuthenticationError:
# Invalid API key
pass
except InsufficientBalanceError:
# Need to top up
pass
except TimeoutError:
# Task took too long
pass
except SolverError:
# Challenge unsolvable
pass
except CapBypassError as e:
# Other API error
print(e.code, e.message)Full Example - AWS WAF
from capbypass import CapBypass
client = CapBypass(
api_key="YOUR_API_KEY",
base_url="https://api.capbypass.pro",
)
solution = client.solve({
"type": "AntiAwsWafTaskProxyLess",
"websiteURL": "https://example.com/protected",
"awsChallengeJS": "https://xxx.token.awswaf.com/xxx/challenge.js",
})
# Use the cookie in your requests
cookie = solution["cookie"]