Reusable captcha router with pluggable solver providers.
Project description
captcha-router
Reusable captcha router with pluggable providers.
Install
pip install .
Publish automation (GitHub Actions)
- Configure Trusted Publishers in PyPI:
- Production: workflow
/.github/workflows/publish.yml, environmentpypi - Test: workflow
/.github/workflows/publish-testpypi.yml, environmenttestpypi
- Bump
versioninpyproject.tomland commit. - For TestPyPI (release candidate), tag with
-rc:
git tag v0.1.1-rc1
git push origin v0.1.1-rc1
- For production PyPI, push a stable tag:
git tag v0.1.1
git push origin v0.1.1
Optional: publish on version change
The workflow /.github/workflows/publish-on-version-change.yml is manual-only by default.
- Open GitHub Actions and run
Publish on Version Change (Optional). - Choose target:
testpypiorpypi.
If you want auto-publish on main when pyproject.toml changes, uncomment the push trigger block in that workflow file.
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 whenapi_keyis 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file captcha_router-0.1.0.tar.gz.
File metadata
- Download URL: captcha_router-0.1.0.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27d3536293e33f862ccf5b43a3a0c40f34e605d34dfb0304875d46c77dd96f45
|
|
| MD5 |
29bdda28bc774303783f788e6fd2efcc
|
|
| BLAKE2b-256 |
3edff39f64dda241218e6cfc71b44f063ce9e002af4009b813d286a19d6da95d
|
File details
Details for the file captcha_router-0.1.0-py3-none-any.whl.
File metadata
- Download URL: captcha_router-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ade70b712ddb27af870408820e96c08874f51c31f42b96eb30fb58dcf261911
|
|
| MD5 |
e929d9e378a4fb503a0c72bd3d933f36
|
|
| BLAKE2b-256 |
903d2a738ba724886140ca0b85b9853f568a2189dd17309fd009fd7db08e2315
|