Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Examples

The examples show how to use the Captcha Solver Python SDK with both the synchronous and asynchronous clients.

Before you start

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_key

Replace 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.

Directories

  • sync contains blocking examples using CaptchaClient.
  • async contains asynchronous examples using AsyncCaptchaClient.
  • assets contains 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

Running an example

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.py

Async 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.

Important notes

  • 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.py needs a fresh challenge for every request; it expires quickly and must not be hardcoded.
  • Files using *Task instead of *TaskProxyless demonstrate 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.