Skip to main content

Official Python SDK for CaptchaSolv.com - Fast captcha solving API

Project description

CaptchaSolv Python SDK

Official Python library for CaptchaSolv.com - Fast and reliable captcha solving API.

PyPI version Python License: MIT

Supported Captcha Types

  • ReCaptcha V3
  • Cloudflare Turnstile
  • GeeTest V4
  • Akamai Bot Manager
  • Kasada
  • DataDome
  • AWS WAF

Installation

pip install captchasolv

For async support:

pip install captchasolv[async]

Quick Start

from captchasolv import CaptchaSolv

solver = CaptchaSolv("YOUR_API_KEY")

result = solver.turnstile(
    website_url="https://example.com",
    website_key="0x4AAAAAAABS7vwvV6VFfMcD"
)

print(result.solution.token)

Async Usage

import asyncio
from captchasolv import AsyncCaptchaSolv

async def main():
    async with AsyncCaptchaSolv("YOUR_API_KEY") as solver:
        result = await solver.turnstile(
            website_url="https://example.com",
            website_key="0x4AAAAAAABS7vwvV6VFfMcD"
        )
        print(result.solution.token)

asyncio.run(main())

Examples

ReCaptcha V3

result = solver.recaptcha_v3(
    website_url="https://example.com",
    website_key="6Le-wvkSAAAAAPBMRTvw0Q4Muexq1bi0DJwx_mJ-",
    page_action="login"
)

Cloudflare Turnstile

result = solver.turnstile(
    website_url="https://example.com",
    website_key="0x4AAAAAAABS7vwvV6VFfMcD"
)

Akamai

result = solver.akamai(
    website_url="https://example.com",
    akamai_script="https://example.com/path/to/akamai/script.js",  # or use website_key
    data={
        "_abck": "current_abck_cookie_value",
        "bm_sz": "current_bm_sz_cookie_value"
    }
)
print(result.solution.token)       # Cookie string: "_abck=...; bm_sz=..."
print(result.solution.user_agent)  # User-Agent to use in requests

Kasada

result = solver.kasada(
    website_url="https://example.com",
    pjs="https://example.com/path/to/kasada/script.js",  # or use website_key
    v="optional_version"
)
print(result.solution.headers)

DataDome

result = solver.datadome(
    website_url="https://example.com",
    captcha_url="https://geo.captcha-delivery.com/captcha/?..."
)
print(result.solution.cookies)

AWS WAF

result = solver.aws_waf(
    website_url="https://example.com",
    aws_key="AQIDAHjcYu/GjX+QlghicBg..."
)

GeeTest V4

result = solver.geetest_v4(
    website_url="https://example.com",
    website_key="647f5ed2ed8acb4be36784e01556bb71"
)

Using Proxies

All convenience methods support an optional proxy parameter:

# Turnstile with proxy
result = solver.turnstile(
    website_url="https://example.com",
    website_key="0x4AAAAAAABS7vwvV6VFfMcD",
    proxy="http://user:pass@proxy.example.com:8080"
)

# Akamai with proxy
result = solver.akamai(
    website_url="https://example.com",
    akamai_script="https://example.com/script.js",
    proxy="socks5://user:pass@proxy.example.com:1080"
)

# Kasada with proxy
result = solver.kasada(
    website_url="https://example.com",
    pjs="https://example.com/ips.js",
    proxy="http://proxy.example.com:8080"
)

Supported Proxy Formats

http://host:port
http://user:pass@host:port
https://user:pass@host:port
socks4://host:port
socks5://user:pass@host:port

Generic Solve Method

For advanced usage or custom task types:

from captchasolv import CaptchaSolv, TaskType

solver = CaptchaSolv("YOUR_API_KEY")

result = solver.solve(
    task_type=TaskType.TURNSTILE,
    website_url="https://example.com",
    website_key="0x4AAAAAAABS7vwvV6VFfMcD",
    user_agent="Mozilla/5.0 ...",
)

Async/Polling Mode

For long-running tasks, you can create a task and poll separately:

task_id = solver.create_task(
    task_type=TaskType.TURNSTILE,
    website_url="https://example.com",
    website_key="0x4AAAAAAABS7vwvV6VFfMcD"
)

result = solver.wait_for_result(task_id, timeout=120)
print(result.solution.token)

Check Balance

balance = solver.get_balance()
print(f"Balance: ${balance}")

Error Handling

from captchasolv import (
    CaptchaSolv,
    CaptchaSolvError,
    InvalidKeyError,
    LimitExceededError,
    CaptchaUnsolvableError,
)

try:
    result = solver.turnstile(...)
except InvalidKeyError:
    print("Invalid API key")
except LimitExceededError:
    print("Balance exhausted or rate limit reached")
except CaptchaUnsolvableError:
    print("Failed to solve captcha, retry")
except CaptchaSolvError as e:
    print(f"Error {e.error_code}: {e.error_description}")

Configuration

solver = CaptchaSolv(
    api_key="YOUR_API_KEY",
    base_url="https://v1.captchasolv.com",
    timeout=130.0,
    poll_interval=3.0,
)

Response Object

result = solver.recaptcha_v2(...)

print(result.status)
print(result.solution.token)
print(result.solution.user_agent)
print(result.solution.cookies)
print(result.cost)
print(result.solve_count)

Links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

captchasolv-1.0.2.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

captchasolv-1.0.2-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file captchasolv-1.0.2.tar.gz.

File metadata

  • Download URL: captchasolv-1.0.2.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for captchasolv-1.0.2.tar.gz
Algorithm Hash digest
SHA256 da10d849c95fd693e53184d3abe12eaa6457f6d07e8e3959daf168a08c9d37e0
MD5 9b845236fdf628f23b6ea1af7397ece6
BLAKE2b-256 bc5d9bcef9e1ddb2929d1d552011dd02b7f7d8b7e91298b3b823e0ef1220d389

See more details on using hashes here.

File details

Details for the file captchasolv-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: captchasolv-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for captchasolv-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 10928d6f46bd2a2d0acbbcf8c34b8cd738369d39dcc16a7bfb33532fb999b49f
MD5 b41faf0709d79eba78cffdff707983d7
BLAKE2b-256 94aca20eeef6d5f4203885fb0bbdad3a9b1ead7481d685a95d487e8f368be69f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page