Skip to main content

Python SDK for the CapSkip local captcha solver

Project description

CapSkip Python SDK

Python 3.10+ License: MIT Tests

Official Python client for the CapSkip local captcha solver.

CapSkip runs on your machine and exposes a standard captcha-solver HTTP API (the familiar in.php / res.php endpoints). This SDK wraps that API with clean, familiar method names, so you can solve captchas locally — no cloud service and no per-solve API fees beyond your CapSkip license.


Quick start (5 minutes)

1. Install CapSkip

Download and run the CapSkip desktop app from capskip.com. Leave it running in the background.

In CapSkip settings, note:

  • API port (default: 8080)
  • API key (optional — if validation is disabled, any string works)

2. Install the SDK

pip install capskip

Or from source:

git clone https://github.com/capskip/capskip-python.git
cd capskip-python
pip install -e .

3. Solve your first captcha

from capskip import CapSkip

solver = CapSkip(host="127.0.0.1", port=8080)

result = solver.recaptcha(
    sitekey="YOUR_SITEKEY",
    url="https://example.com/page-with-recaptcha",
)

print(result["code"])  # g-recaptcha-response token

Prerequisite: CapSkip must be running before you call the SDK. If you see a connection error, see Troubleshooting.


Supported captcha types

Type SDK method
Image CAPTCHA (distorted text) solver.normal(file)
reCAPTCHA v2 (checkbox) solver.recaptcha(sitekey, url)
reCAPTCHA v2 Invisible solver.recaptcha(..., invisible=1)
reCAPTCHA v2 Enterprise solver.recaptcha(..., enterprise=1)
reCAPTCHA v3 solver.recaptcha(..., version="v3")
reCAPTCHA v3 Enterprise solver.recaptcha(..., version="v3", enterprise=1)
Cloudflare Turnstile (widget) solver.turnstile(sitekey, url)
Cloudflare Turnstile (challenge page) solver.turnstile(..., data=..., pagedata=...)

Documentation

Guide Description
Tutorial Complete walkthrough of every captcha type, sync and async
Getting Started Full setup: CapSkip app, SDK install, first script
API Reference All classes, methods, parameters, and return values
Examples Ready-to-run scripts for every captcha type
Troubleshooting Connection errors, timeouts, proxy issues
Contributing Development setup, tests, pull requests
Changelog Release history

Configuration

from capskip import CapSkip

solver = CapSkip(
    apiKey="capskip",        # your CapSkip API key (or any string if validation is off)
    host="127.0.0.1",        # CapSkip host
    port=8080,               # CapSkip port from app settings
    defaultTimeout=120,      # seconds — image captcha polling timeout
    recaptchaTimeout=300,    # seconds — reCAPTCHA / Turnstile polling timeout
    pollingInterval=5,       # max seconds between res.php polls (starts at 0.25s, backs off to this)
)

Use environment variables in production:

# Linux / macOS
export CAPSKIP_API_KEY="your-key"
export CAPSKIP_HOST="127.0.0.1"
export CAPSKIP_PORT="8080"
# Windows PowerShell
$env:CAPSKIP_API_KEY = "your-key"
$env:CAPSKIP_HOST = "127.0.0.1"
$env:CAPSKIP_PORT = "8080"
import os
from capskip import CapSkip

solver = CapSkip(
    apiKey=os.getenv("CAPSKIP_API_KEY", "capskip"),
    host=os.getenv("CAPSKIP_HOST", "127.0.0.1"),
    port=int(os.getenv("CAPSKIP_PORT", "8080")),
)

Usage examples

Image captcha

result = solver.normal("captcha.png")
result = solver.normal("https://example.com/captcha.jpg")
result = solver.normal("data:image/png;base64,iVBORw0KGgo...")
print(result["code"])

reCAPTCHA v2 / v3

# reCAPTCHA v2
result = solver.recaptcha(sitekey="...", url="https://example.com")

# reCAPTCHA v3
result = solver.recaptcha(
    sitekey="...",
    url="https://example.com",
    version="v3",
    action="submit",
    score=0.7,
)

Cloudflare Turnstile

result = solver.turnstile(
    sitekey="0x4AAAAAAA...",
    url="https://example.com",
)

With a proxy (reCAPTCHA & Turnstile only)

# Proxy is not supported for image captcha
result = solver.recaptcha(
    sitekey="...",
    url="https://example.com",
    proxy={"type": "HTTPS", "uri": "user:pass@1.2.3.4:3128"},
)
result = solver.turnstile(
    sitekey="...",
    url="https://example.com",
    proxy={"type": "HTTP", "uri": "1.2.3.4:3128"},
)

Async (parallel solving)

import asyncio
from capskip import AsyncCapSkip

async def main():
    solver = AsyncCapSkip()
    r1, r2 = await asyncio.gather(
        solver.recaptcha(sitekey="...", url="https://a.com"),
        solver.turnstile(sitekey="...", url="https://b.com"),
    )
    print(r1["code"], r2["code"])

asyncio.run(main())

More examples: examples/


Return value

Every solve method returns:

{
    "captchaId": "12345",   # internal ID from CapSkip
    "code": "TOKEN_OR_TEXT" # solution — text for image, token for reCAPTCHA/Turnstile
    "userAgent": "..."      # Turnstile only — use when submitting challenge-page tokens
}

Error handling

from capskip import CapSkip, ValidationException, NetworkException, ApiException, TimeoutException

try:
    result = solver.recaptcha(sitekey="...", url="...")
except ValidationException:
    pass  # invalid parameters
except NetworkException:
    pass  # CapSkip not running, or captcha not ready (manual polling)
except ApiException:
    pass  # API returned an error code
except TimeoutException:
    pass  # polling timeout exceeded

Development

git clone https://github.com/capskip/capskip-python.git
cd capskip-python
python -m venv .venv

# Windows
.venv\Scripts\activate

# Linux / macOS
source .venv/bin/activate

pip install -e ".[dev]"
pytest

See CONTRIBUTING.md for the full development workflow.


Links


License

MIT — see LICENSE.

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

capskip-1.0.1.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

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

capskip-1.0.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file capskip-1.0.1.tar.gz.

File metadata

  • Download URL: capskip-1.0.1.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for capskip-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8d4ae4c62150827b17ba494ba8fe975b4d6e4ff9329e194b5fa8ef507757377a
MD5 456050e5cf7a8e59cd8ec539fc1f9ed7
BLAKE2b-256 d30635bea2e228978bfc9cc85ca64067cdc2f649dc88c465f2c732c56e3e58c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for capskip-1.0.1.tar.gz:

Publisher: publish.yml on capskip/capskip-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file capskip-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: capskip-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for capskip-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c12ee6990ae1c5bbc53b46c02dff687a2f824251afbc2bd4ffeda3d65c6ca5da
MD5 c865ae9409aed7f8ce3cd2c550493990
BLAKE2b-256 f4a36b0de039189e7a1e3c713f623b00c0685f992c47a2d319a29c33dcef58d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for capskip-1.0.1-py3-none-any.whl:

Publisher: publish.yml on capskip/capskip-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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