Skip to main content

Reusable captcha router with pluggable solver providers.

Project description

captcha-router

Reusable captcha router with pluggable providers.

Install

pip install captcha-router
uv add captcha-router

Supported providers

  • anticaptcha (alias: anti-captcha)
  • 2captcha (alias: twocaptcha)

Router methods

  • CaptchaRouter.list_providers(): returns all registered provider names and aliases.
  • CaptchaRouter.list_provider_capabilities(include_aliases=False): returns provider -> supported captcha kinds.
  • CaptchaRouter.get_supported_task_kinds(provider_name): returns supported captcha kinds for one provider.
  • CaptchaRouter.list_supported_task_kinds(): returns union of captcha kinds across providers.
  • CaptchaRouter.get_solver(provider_name=None, api_key=None, **kwargs): creates a solver instance and uses env fallbacks when api_key is omitted.

Usage

1) Create a solver

from captcha_router import CaptchaRouter

solver = CaptchaRouter.get_solver(provider_name="anticaptcha", api_key="YOUR_KEY")

2) Solve a task

import asyncio
from captcha_router import CaptchaRouter, CaptchaTaskSpec


async def main():
    solver = CaptchaRouter.get_solver(provider_name="anticaptcha", api_key="YOUR_KEY")
    try:
        result = await solver.solve_task(
            CaptchaTaskSpec(
                kind="recaptcha_v2",
                params={
                    "website_url": "https://example.com",
                    "site_key": "SITE_KEY_HERE",
                },
            )
        )
        print(result.status, result.token, result.error)
    finally:
        await solver.close()


asyncio.run(main())

3) Inspect capabilities

from captcha_router import CaptchaRouter

print(CaptchaRouter.list_providers())
print(CaptchaRouter.list_provider_capabilities())

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

captcha_router-0.1.3.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

captcha_router-0.1.3-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file captcha_router-0.1.3.tar.gz.

File metadata

  • Download URL: captcha_router-0.1.3.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for captcha_router-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a83270071cf8d829e0560db0c7c5cbf45ee15f9b41168c3569ed7853ab482783
MD5 b34daa3befd57fc9bfabf0a8cf299e65
BLAKE2b-256 689e5f522496ad99b043fdb0de3ad4a839f45f8319baf0791dc5aff02c3151fd

See more details on using hashes here.

File details

Details for the file captcha_router-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: captcha_router-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for captcha_router-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4c7a8c5d11fd19c1dcbd3e0c1b6dd390a63fc5652ab9ab4c177c87115473e80f
MD5 f48f56ab1729e8b0d1e61d14ebf5efb2
BLAKE2b-256 e1f0cdb085048e9fca0c4969463c24274d134330eb7bb2bd5c36c9095fe240d5

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