The examples show how to use the Captcha Solver Python SDK with both the synchronous and asynchronous clients.
Install the SDK dependencies from the repository root:
pip install -e .Set CAPTCHA_API_KEY in the environment or in a .env file in the repository root. The examples load that file automatically when python-dotenv is installed:
$env:CAPTCHA_API_KEY = "your_api_key"export CAPTCHA_API_KEY=your_api_keyReplace placeholder values such as YOUR_WEBSITE_KEY, YOUR_APP_ID, YOUR_CAPTCHA_ID, and proxy credentials before running token or proxy examples. Do not commit real API keys or proxy credentials.
synccontains blocking examples usingCaptchaClient.asynccontains asynchronous examples usingAsyncCaptchaClient.assetscontains sample images used by image and coordinate examples.
Each supported CAPTCHA type has a matching sync and async script:
| CAPTCHA type | Sync | Async | Main result |
|---|---|---|---|
| Account balance | balance.py | balance.py | float balance |
| reCAPTCHA v2 | recaptcha_v2.py | recaptcha_v2.py | gRecaptchaResponse |
| reCAPTCHA v2 Enterprise | recaptcha_v2_enterprise.py | recaptcha_v2_enterprise.py | gRecaptchaResponse |
| reCAPTCHA v3 | recaptcha_v3.py | recaptcha_v3.py | gRecaptchaResponse |
| Cloudflare Turnstile | turnstile.py | turnstile.py | token |
| Image to Text | image_to_text.py | image_to_text.py | text |
| GeeTest v3 | geetest_v3.py | geetest_v3.py | challenge, validate, seccode |
| GeeTest v4 | geetest_v4.py | geetest_v4.py | captcha_output and related fields |
| Yandex SmartCaptcha token | yandex_smartcaptcha.py | yandex_smartcaptcha.py | token |
| Yandex SmartCaptcha image | yandex_smartcaptcha_image.py | yandex_smartcaptcha_image.py | coordinates |
| Coordinates / click captcha | coordinates.py | coordinates.py | coordinates |
| Tencent | tencent.py | tencent.py | appid, ret, ticket, randstr |
Run commands from the repository root so local imports and bundled assets resolve correctly:
python examples/sync/balance.py
python examples/sync/image_to_text.py
python examples/async/recaptcha_v2.pyAsync scripts create an AsyncCaptchaClient and await the same operations as the synchronous client. For several captchas, see the parallel solving pattern in the main README.
- Image examples can use the bundled files in
examples/assets; they do not require a target website. - Token examples use placeholder site keys and URLs. Replace them with values from a page you are authorized to test.
geetest_v3.pyneeds a freshchallengefor every request; it expires quickly and must not be hardcoded.- Files using
*Taskinstead of*TaskProxylessdemonstrate solving through your own proxy. Supply valid proxy settings for your account. - For task parameters and response formats, see the CAPTCHA type documentation.
- For client methods and errors, see the main README.