Skip to main content

CapBypass Python SDK

PyPI version Python versions Downloads GitHub stars

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",
})

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

🔄 Migration

Examples

Basic Examples

See examples/ directory for complete runnable examples:

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.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for capbypass-sdk 1.0.13
File Size Uploaded Provenance Actions
capbypass_sdk-1.0.13.tar.gz 12.2 kB Without provenance Details for capbypass_sdk-1.0.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for capbypass-sdk 1.0.13
File Interpreter ABI Platform Actions
capbypass_sdk-1.0.13-py3-none-any.whl Python 3 none any Details for capbypass_sdk-1.0.13-py3-none-any.whl

Total release size: 22.9 kB

Release files / capbypass_sdk-1.0.13.tar.gz

Download URL capbypass_sdk-1.0.13.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
84a954df24995820d0bffc43fd17993fc56b78f64af8f562463707b90b74eceb
BLAKE2b-256 checksum
How to use checksums
63574795bc8542fc1c70fe1a71be8567a0f7cd79f1294fc16b0c12c078175c8d
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.13-py3-none-any.whl

Download URL capbypass_sdk-1.0.13-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02fb1dcd83dc1c704ed4f3a6356afd7e5801ea1a6972cfa73b2dd8c24815df8c
BLAKE2b-256 checksum
How to use checksums
8b69a54d15d7258f5d9a12f37b7fa6c64d8de717951453de98c777522917bf1c
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.13

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page