diff --git a/examples/async/balance.py b/examples/async/balance.py index 3c81311..d581a7d 100644 --- a/examples/async/balance.py +++ b/examples/async/balance.py @@ -1,9 +1,15 @@ -""" -Example: Get account balance with the async client. +"""Example: Check the current Captcha Solver account balance without creating a CAPTCHA task. + +What it does: + This example shows how to check the current Captcha Solver account balance without creating a CAPTCHA task. It uses AsyncCaptchaClient.get_balance() and returns the account balance. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Call await solver.get_balance(); this does not create or poll a CAPTCHA task. + STEP-03 - Print the balance returned by the API. Prerequisites: Set the CAPTCHA_API_KEY environment variable. - Returns the current available balance of your account. """ import asyncio @@ -25,10 +31,10 @@ from captcha_solver_api import AsyncCaptchaClient # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/async/coordinates.py b/examples/async/coordinates.py index 70663b6..b91645a 100644 --- a/examples/async/coordinates.py +++ b/examples/async/coordinates.py @@ -1,5 +1,13 @@ -""" -Example: Solve a click-based image captcha using CoordinatesTask with the async client. +"""Example: Solve click-based image CAPTCHAs from bundled local images without a proxy. + +What it does: + This example shows how to solve click-based image CAPTCHAs from bundled local images without a proxy. It uses CoordinatesTask and AsyncCaptchaClient.solve(), returning pixel coordinates to click. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. The image, optional instruction image, and click hints come from examples/assets and this file. + STEP-03 - Create CoordinatesTask and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print pixel coordinates to click. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. diff --git a/examples/async/geetest_v3_proxy.py b/examples/async/geetest_v3_proxy.py index ce6bc1e..c82445b 100644 --- a/examples/async/geetest_v3_proxy.py +++ b/examples/async/geetest_v3_proxy.py @@ -1,15 +1,24 @@ -""" -Example: Solve a GeeTest v3 challenge with the async client. +"""Example: Solve GeeTest v3 through your own proxy. + +What it does: + This example shows how to solve GeeTest v3 through your own proxy. It uses GeeTestTask and AsyncCaptchaClient.solve(), returning challenge, validate, and seccode values. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract the GeeTest values from the target page, fetch a fresh challenge, and provide your proxy settings. + STEP-03 - Create GeeTestTask and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print challenge, validate, and seccode values. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. Replace websiteURL, gt, and challenge with values from your target page. Important: the challenge value is dynamic. Fetch a fresh one for each request. -NOTE: "https://target-site.com/path/to/geetest/init" below is a PLACEHOLDER, not a -real endpoint -- this script will not run end-to-end as-is. Replace it with a request -to your actual target page (or wherever it exposes a fresh `challenge` value) before -running this example. It's here only to illustrate where that fetch belongs in the flow. + NOTE: "https://target-site.com/path/to/geetest/init" below is a PLACEHOLDER, not a + real endpoint -- this script will not run end-to-end as-is. Replace it with a request + to your actual target page (or wherever it exposes a fresh `challenge` value) before + running this example. It's here only to illustrate where that fetch belongs in the flow. + Replace the proxy placeholders with your own proxy settings. """ import asyncio diff --git a/examples/async/geetest_v3_proxyless.py b/examples/async/geetest_v3_proxyless.py index 1d9ffec..854f9c9 100644 --- a/examples/async/geetest_v3_proxyless.py +++ b/examples/async/geetest_v3_proxyless.py @@ -1,15 +1,23 @@ -""" -Example: Solve a GeeTest v3 challenge with the async client. +"""Example: Solve GeeTest v3 without a proxy. + +What it does: + This example shows how to solve GeeTest v3 without a proxy. It uses GeeTestTaskProxyless and AsyncCaptchaClient.solve(), returning challenge, validate, and seccode values. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL and gt from the target page and fetch a fresh challenge for every request. + STEP-03 - Create GeeTestTaskProxyless and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print challenge, validate, and seccode values. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. Replace websiteURL, gt, and challenge with values from your target page. Important: the challenge value is dynamic. Fetch a fresh one for each request. -NOTE: "https://target-site.com/path/to/geetest/init" below is a PLACEHOLDER, not a -real endpoint -- this script will not run end-to-end as-is. Replace it with a request -to your actual target page (or wherever it exposes a fresh `challenge` value) before -running this example. It's here only to illustrate where that fetch belongs in the flow. + NOTE: "https://target-site.com/path/to/geetest/init" below is a PLACEHOLDER, not a + real endpoint -- this script will not run end-to-end as-is. Replace it with a request + to your actual target page (or wherever it exposes a fresh `challenge` value) before + running this example. It's here only to illustrate where that fetch belongs in the flow. """ import asyncio diff --git a/examples/async/geetest_v4_proxy.py b/examples/async/geetest_v4_proxy.py index 506af84..99184f0 100644 --- a/examples/async/geetest_v4_proxy.py +++ b/examples/async/geetest_v4_proxy.py @@ -1,5 +1,13 @@ -""" -Example: Solve a GeeTest v4 challenge with the async client. +"""Example: Solve GeeTest v4 through your own proxy. + +What it does: + This example shows how to solve GeeTest v4 through your own proxy. It uses GeeTestTask and AsyncCaptchaClient.solve(), returning captcha_output and related validation fields. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL and captcha_id from the target page and provide your proxy settings. + STEP-03 - Create GeeTestTask and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print captcha_output and related validation fields. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. @@ -7,6 +15,7 @@ GeeTest v4 drops gt/challenge entirely. It uses captcha_id instead, which (unlike v3's challenge) is static per site, so it doesn't need to be re-fetched for every request. + Replace the proxy placeholders with your own proxy settings. """ import asyncio diff --git a/examples/async/geetest_v4_proxyless.py b/examples/async/geetest_v4_proxyless.py index 5668b8d..caec4f2 100644 --- a/examples/async/geetest_v4_proxyless.py +++ b/examples/async/geetest_v4_proxyless.py @@ -1,5 +1,13 @@ -""" -Example: Solve a GeeTest v4 challenge with the async client. +"""Example: Solve GeeTest v4 without a proxy. + +What it does: + This example shows how to solve GeeTest v4 without a proxy. It uses GeeTestTaskProxyless and AsyncCaptchaClient.solve(), returning captcha_output and related validation fields. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL and captcha_id from the target page. + STEP-03 - Create GeeTestTaskProxyless and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print captcha_output and related validation fields. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. diff --git a/examples/async/image_to_text.py b/examples/async/image_to_text.py index db6fb9a..bb9921a 100644 --- a/examples/async/image_to_text.py +++ b/examples/async/image_to_text.py @@ -1,9 +1,18 @@ -""" -Example: Solve an image captcha with the async client. +"""Example: Recognize text in bundled local CAPTCHA images without a proxy. + +What it does: + This example shows how to recognize text in bundled local CAPTCHA images without a proxy. It uses ImageToTextTask and AsyncCaptchaClient.solve(), returning the recognized text. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. The images and answer-format hints come from examples/assets and this file. + STEP-03 - Create ImageToTextTask and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print the recognized text. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. Ready to run as-is: sample captcha images are bundled in examples/assets/. + Use optional fields to give hints to the worker for faster solving. """ import asyncio diff --git a/examples/async/recaptcha_v2_enterprise_proxy.py b/examples/async/recaptcha_v2_enterprise_proxy.py index 4389924..d4ede93 100644 --- a/examples/async/recaptcha_v2_enterprise_proxy.py +++ b/examples/async/recaptcha_v2_enterprise_proxy.py @@ -1,10 +1,19 @@ -""" -Example: Solve a reCAPTCHA v2 Enterprise challenge with the async client. +"""Example: Solve reCAPTCHA v2 Enterprise through your own proxy. + +What it does: + This example shows how to solve reCAPTCHA v2 Enterprise through your own proxy. It uses RecaptchaV2EnterpriseTask and AsyncCaptchaClient.solve(), returning a gRecaptchaResponse token. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL, websiteKey, and any enterprisePayload from the target page, and provide your proxy settings. + STEP-03 - Create RecaptchaV2EnterpriseTask and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print a gRecaptchaResponse token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. Replace websiteURL and websiteKey with values from your target page. If the site uses enterprisePayload, extract and pass it or the token may be rejected. + Replace the proxy placeholders with your own proxy settings. """ import asyncio diff --git a/examples/async/recaptcha_v2_enterprise_proxyless.py b/examples/async/recaptcha_v2_enterprise_proxyless.py index 10d157f..fa59c9b 100644 --- a/examples/async/recaptcha_v2_enterprise_proxyless.py +++ b/examples/async/recaptcha_v2_enterprise_proxyless.py @@ -1,5 +1,13 @@ -""" -Example: Solve a reCAPTCHA v2 Enterprise challenge with the async client. +"""Example: Solve reCAPTCHA v2 Enterprise without a proxy. + +What it does: + This example shows how to solve reCAPTCHA v2 Enterprise without a proxy. It uses RecaptchaV2EnterpriseTaskProxyless and AsyncCaptchaClient.solve(), returning a gRecaptchaResponse token. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL, websiteKey, and any enterprisePayload from the target page. + STEP-03 - Create RecaptchaV2EnterpriseTaskProxyless and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print a gRecaptchaResponse token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. diff --git a/examples/async/recaptcha_v2_proxy.py b/examples/async/recaptcha_v2_proxy.py index 6cd87d9..bab697f 100644 --- a/examples/async/recaptcha_v2_proxy.py +++ b/examples/async/recaptcha_v2_proxy.py @@ -1,5 +1,13 @@ -""" -Example: Solve a reCAPTCHA v2 challenge through your own proxy with the async client. +"""Example: Solve reCAPTCHA v2 through your own proxy. + +What it does: + This example shows how to solve reCAPTCHA v2 through your own proxy. It uses RecaptchaV2Task and AsyncCaptchaClient.solve(), returning a gRecaptchaResponse token. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL and websiteKey from the target page and provide your proxy settings. + STEP-03 - Create RecaptchaV2Task and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print a gRecaptchaResponse token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. diff --git a/examples/async/recaptcha_v2_proxyless.py b/examples/async/recaptcha_v2_proxyless.py index 01d2626..f327978 100644 --- a/examples/async/recaptcha_v2_proxyless.py +++ b/examples/async/recaptcha_v2_proxyless.py @@ -1,5 +1,13 @@ -""" -Example: Solve a reCAPTCHA v2 challenge without a proxy with the async client. +"""Example: Solve reCAPTCHA v2 without a proxy. + +What it does: + This example shows how to solve reCAPTCHA v2 without a proxy. It uses RecaptchaV2TaskProxyless and AsyncCaptchaClient.solve(), returning a gRecaptchaResponse token. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL and websiteKey from the target page. + STEP-03 - Create RecaptchaV2TaskProxyless and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print a gRecaptchaResponse token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. diff --git a/examples/async/recaptcha_v3.py b/examples/async/recaptcha_v3.py index d4bb2a7..e08da88 100644 --- a/examples/async/recaptcha_v3.py +++ b/examples/async/recaptcha_v3.py @@ -1,11 +1,19 @@ -""" -Example: Solve a reCAPTCHA v3 challenge with the async client. +"""Example: Solve score-based reCAPTCHA v3 without a proxy. + +What it does: + This example shows how to solve score-based reCAPTCHA v3 without a proxy. It uses RecaptchaV3TaskProxyless and AsyncCaptchaClient.solve(), returning a gRecaptchaResponse token. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL, websiteKey, and pageAction from the target page, then choose the required minimum score. + STEP-03 - Create RecaptchaV3TaskProxyless and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print a gRecaptchaResponse token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. - Replace websiteURL, websiteKey, and minScore with values from your target - page, and pass pageAction if the site uses it -- this increases the - chance of the token being accepted. + Replace websiteURL and websiteKey with values from your target page, pass + pageAction if the site uses it, and choose the minimum score your + integration requires. """ import asyncio diff --git a/examples/async/tencent_proxy.py b/examples/async/tencent_proxy.py index c92644e..5263c8c 100644 --- a/examples/async/tencent_proxy.py +++ b/examples/async/tencent_proxy.py @@ -1,10 +1,19 @@ -""" -Example: Solve a Tencent captcha challenge with the async client. +"""Example: Solve Tencent CAPTCHA through your own proxy. + +What it does: + This example shows how to solve Tencent CAPTCHA through your own proxy. It uses TencentTask and AsyncCaptchaClient.solve(), returning appid, ret, ticket, and randstr values. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL, appId, and any non-default captchaScript from the target page, then provide your proxy settings. + STEP-03 - Create TencentTask and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print appid, ret, ticket, and randstr values. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. Replace websiteURL and appId with values from your target page. Pass captchaScript if the site uses a non-default script URL. + Replace the proxy placeholders with your own proxy settings. """ import asyncio diff --git a/examples/async/tencent_proxyless.py b/examples/async/tencent_proxyless.py index a840450..e678b6b 100644 --- a/examples/async/tencent_proxyless.py +++ b/examples/async/tencent_proxyless.py @@ -1,5 +1,13 @@ -""" -Example: Solve a Tencent captcha challenge with the async client. +"""Example: Solve Tencent CAPTCHA without a proxy. + +What it does: + This example shows how to solve Tencent CAPTCHA without a proxy. It uses TencentTaskProxyless and AsyncCaptchaClient.solve(), returning appid, ret, ticket, and randstr values. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL, appId, and any non-default captchaScript from the target page. + STEP-03 - Create TencentTaskProxyless and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print appid, ret, ticket, and randstr values. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. diff --git a/examples/async/turnstile_proxy.py b/examples/async/turnstile_proxy.py index f46b797..756a964 100644 --- a/examples/async/turnstile_proxy.py +++ b/examples/async/turnstile_proxy.py @@ -1,10 +1,19 @@ -""" -Example: Solve a Cloudflare Turnstile challenge with the async client. +"""Example: Solve Cloudflare Turnstile through your own proxy. + +What it does: + This example shows how to solve Cloudflare Turnstile through your own proxy. It uses TurnstileTask and AsyncCaptchaClient.solve(), returning a token. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL, websiteKey, and any Challenge-page action, data, and pagedata values, then provide your proxy settings. + STEP-03 - Create TurnstileTask and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print a token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. Replace websiteURL and websiteKey with values from your target page. For Cloudflare Challenge pages, also extract and pass action, data, and pagedata. + Replace the proxy placeholders with your own proxy settings. """ import asyncio diff --git a/examples/async/turnstile_proxyless.py b/examples/async/turnstile_proxyless.py index 76dd7f2..c4c380b 100644 --- a/examples/async/turnstile_proxyless.py +++ b/examples/async/turnstile_proxyless.py @@ -1,5 +1,13 @@ -""" -Example: Solve a Cloudflare Turnstile challenge with the async client. +"""Example: Solve Cloudflare Turnstile without a proxy. + +What it does: + This example shows how to solve Cloudflare Turnstile without a proxy. It uses TurnstileTaskProxyless and AsyncCaptchaClient.solve(), returning a token. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL, websiteKey, and any Challenge-page action, data, and pagedata values from the target page. + STEP-03 - Create TurnstileTaskProxyless and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print a token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. diff --git a/examples/async/yandex_smartcaptcha_image.py b/examples/async/yandex_smartcaptcha_image.py index a89202c..6fa40aa 100644 --- a/examples/async/yandex_smartcaptcha_image.py +++ b/examples/async/yandex_smartcaptcha_image.py @@ -1,4 +1,13 @@ -"""Example: Solve an image-based Yandex SmartCaptcha asynchronously. +"""Example: Solve an image-based Yandex SmartCaptcha from bundled local images without a proxy. + +What it does: + This example shows how to solve an image-based Yandex SmartCaptcha from bundled local images without a proxy. It uses YandexSmartCaptchaImageTask and AsyncCaptchaClient.solve(), returning pixel coordinates to click. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. The challenge and instruction images come from examples/assets. + STEP-03 - Create YandexSmartCaptchaImageTask and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print pixel coordinates to click. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. diff --git a/examples/async/yandex_smartcaptcha_kaleidoscope.py b/examples/async/yandex_smartcaptcha_kaleidoscope.py index e49a799..0be5646 100644 --- a/examples/async/yandex_smartcaptcha_kaleidoscope.py +++ b/examples/async/yandex_smartcaptcha_kaleidoscope.py @@ -1,15 +1,13 @@ -"""Example: Solve an image-based Yandex SmartCaptcha Kaleidoscope asynchronously. +"""Example: Solve a Yandex SmartCaptcha Kaleidoscope puzzle from a bundled local image without a proxy. -This example reads the bundled Kaleidoscope challenge image, encodes it as -Base64, sends it together with the puzzle-step sequence without a proxy, and -prints how many times to click the slider arrow. It uses -YandexSmartCaptchaKaleidoscopeTask and AsyncCaptchaClient.solve(). +What it does: + This example shows how to solve a Yandex SmartCaptcha Kaleidoscope puzzle from a bundled local image without a proxy. It uses YandexSmartCaptchaKaleidoscopeTask and AsyncCaptchaClient.solve(), returning the number of slider-arrow clicks. How it works: -STEP-01 - Configure AsyncCaptchaClient and locate the bundled challenge image. -STEP-02 - Encode the image and create a task with the captured puzzle steps. -STEP-03 - Await solve(), which creates the task and polls for its solution. -STEP-04 - Print the slider-arrow click count, or report the error. + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. The challenge image comes from examples/assets and the puzzle-step sequence is captured from the challenge. + STEP-03 - Create YandexSmartCaptchaKaleidoscopeTask and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print the number of slider-arrow clicks. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. diff --git a/examples/async/yandex_smartcaptcha_proxy.py b/examples/async/yandex_smartcaptcha_proxy.py index 5cae19b..957f636 100644 --- a/examples/async/yandex_smartcaptcha_proxy.py +++ b/examples/async/yandex_smartcaptcha_proxy.py @@ -1,9 +1,18 @@ -""" -Example: Solve a Yandex SmartCaptcha challenge (token-based) with the async client. +"""Example: Solve token-based Yandex SmartCaptcha through your own proxy. + +What it does: + This example shows how to solve token-based Yandex SmartCaptcha through your own proxy. It uses YandexSmartCaptchaTask and AsyncCaptchaClient.solve(), returning a token. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL and websiteKey from the target page and provide your proxy settings. + STEP-03 - Create YandexSmartCaptchaTask and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print a token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. Replace websiteURL and websiteKey with values from your target page. + Replace the proxy placeholders with your own proxy settings. """ import asyncio diff --git a/examples/async/yandex_smartcaptcha_proxyless.py b/examples/async/yandex_smartcaptcha_proxyless.py index 9537797..3876f44 100644 --- a/examples/async/yandex_smartcaptcha_proxyless.py +++ b/examples/async/yandex_smartcaptcha_proxyless.py @@ -1,5 +1,13 @@ -""" -Example: Solve a Yandex SmartCaptcha challenge (token-based) with the async client. +"""Example: Solve token-based Yandex SmartCaptcha without a proxy. + +What it does: + This example shows how to solve token-based Yandex SmartCaptcha without a proxy. It uses YandexSmartCaptchaTaskProxyless and AsyncCaptchaClient.solve(), returning a token. + +How it works: + STEP-01 - Configure AsyncCaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL and websiteKey from the target page. + STEP-03 - Create YandexSmartCaptchaTaskProxyless and pass it to await solver.solve(task), which creates and polls the task. + STEP-04 - Print a token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. diff --git a/examples/sync/balance.py b/examples/sync/balance.py index f3a6ae7..569fa69 100644 --- a/examples/sync/balance.py +++ b/examples/sync/balance.py @@ -1,9 +1,15 @@ -""" -Example: Get account balance. +"""Example: Check the current Captcha Solver account balance without creating a CAPTCHA task. + +What it does: + This example shows how to check the current Captcha Solver account balance without creating a CAPTCHA task. It uses CaptchaClient.get_balance() and returns the account balance. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Call solver.get_balance(); this does not create or poll a CAPTCHA task. + STEP-03 - Print the balance returned by the API. Prerequisites: Set the CAPTCHA_API_KEY environment variable. - Returns the current available balance of your account. """ import os @@ -24,10 +30,10 @@ from captcha_solver_api import CaptchaClient # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/sync/coordinates.py b/examples/sync/coordinates.py index 59c3421..814d41d 100644 --- a/examples/sync/coordinates.py +++ b/examples/sync/coordinates.py @@ -1,5 +1,13 @@ -""" -Example: Solve a click-based image captcha using CoordinatesTask. +"""Example: Solve click-based image CAPTCHAs from bundled local images without a proxy. + +What it does: + This example shows how to solve click-based image CAPTCHAs from bundled local images without a proxy. It uses CoordinatesTask and CaptchaClient.solve(), returning pixel coordinates to click. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. The image, optional instruction image, and click hints come from examples/assets and this file. + STEP-03 - Create CoordinatesTask and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print pixel coordinates to click. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. @@ -29,10 +37,10 @@ from captcha_solver_api.tasks import CoordinatesTask # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/sync/geetest_v3_proxy.py b/examples/sync/geetest_v3_proxy.py index e91b441..3ed05c6 100644 --- a/examples/sync/geetest_v3_proxy.py +++ b/examples/sync/geetest_v3_proxy.py @@ -1,15 +1,24 @@ -""" -Example: Solve a GeeTest v3 challenge. +"""Example: Solve GeeTest v3 through your own proxy. + +What it does: + This example shows how to solve GeeTest v3 through your own proxy. It uses GeeTestTask and CaptchaClient.solve(), returning challenge, validate, and seccode values. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract the GeeTest values from the target page, fetch a fresh challenge, and provide your proxy settings. + STEP-03 - Create GeeTestTask and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print challenge, validate, and seccode values. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. Replace websiteURL, gt, and challenge with values from your target page. Important: the challenge value is dynamic. Fetch a fresh one for each request. -NOTE: "https://target-site.com/path/to/geetest/init" below is a PLACEHOLDER, not a -real endpoint -- this script will not run end-to-end as-is. Replace it with a request -to your actual target page (or wherever it exposes a fresh `challenge` value) before -running this example. It's here only to illustrate where that fetch belongs in the flow. + NOTE: "https://target-site.com/path/to/geetest/init" below is a PLACEHOLDER, not a + real endpoint -- this script will not run end-to-end as-is. Replace it with a request + to your actual target page (or wherever it exposes a fresh `challenge` value) before + running this example. It's here only to illustrate where that fetch belongs in the flow. + Replace the proxy placeholders with your own proxy settings. """ import os @@ -33,10 +42,10 @@ from captcha_solver_api.tasks import GeeTestTask # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/sync/geetest_v3_proxyless.py b/examples/sync/geetest_v3_proxyless.py index 10503e6..d0c8b7e 100644 --- a/examples/sync/geetest_v3_proxyless.py +++ b/examples/sync/geetest_v3_proxyless.py @@ -1,15 +1,23 @@ -""" -Example: Solve a GeeTest v3 challenge. +"""Example: Solve GeeTest v3 without a proxy. + +What it does: + This example shows how to solve GeeTest v3 without a proxy. It uses GeeTestTaskProxyless and CaptchaClient.solve(), returning challenge, validate, and seccode values. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL and gt from the target page and fetch a fresh challenge for every request. + STEP-03 - Create GeeTestTaskProxyless and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print challenge, validate, and seccode values. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. Replace websiteURL, gt, and challenge with values from your target page. Important: the challenge value is dynamic. Fetch a fresh one for each request. -NOTE: "https://target-site.com/path/to/geetest/init" below is a PLACEHOLDER, not a -real endpoint -- this script will not run end-to-end as-is. Replace it with a request -to your actual target page (or wherever it exposes a fresh `challenge` value) before -running this example. It's here only to illustrate where that fetch belongs in the flow. + NOTE: "https://target-site.com/path/to/geetest/init" below is a PLACEHOLDER, not a + real endpoint -- this script will not run end-to-end as-is. Replace it with a request + to your actual target page (or wherever it exposes a fresh `challenge` value) before + running this example. It's here only to illustrate where that fetch belongs in the flow. """ import os @@ -33,10 +41,10 @@ from captcha_solver_api.tasks import GeeTestTaskProxyless # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/sync/geetest_v4_proxy.py b/examples/sync/geetest_v4_proxy.py index 9d05bdf..cf559e8 100644 --- a/examples/sync/geetest_v4_proxy.py +++ b/examples/sync/geetest_v4_proxy.py @@ -1,5 +1,13 @@ -""" -Example: Solve a GeeTest v4 challenge. +"""Example: Solve GeeTest v4 through your own proxy. + +What it does: + This example shows how to solve GeeTest v4 through your own proxy. It uses GeeTestTask and CaptchaClient.solve(), returning captcha_output and related validation fields. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL and captcha_id from the target page and provide your proxy settings. + STEP-03 - Create GeeTestTask and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print captcha_output and related validation fields. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. @@ -7,6 +15,7 @@ GeeTest v4 drops gt/challenge entirely. It uses captcha_id instead, which (unlike v3's challenge) is static per site, so it doesn't need to be re-fetched for every request. + Replace the proxy placeholders with your own proxy settings. """ import os @@ -28,10 +37,10 @@ from captcha_solver_api.tasks import GeeTestTask # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/sync/geetest_v4_proxyless.py b/examples/sync/geetest_v4_proxyless.py index 55cb061..9cd765d 100644 --- a/examples/sync/geetest_v4_proxyless.py +++ b/examples/sync/geetest_v4_proxyless.py @@ -1,5 +1,13 @@ -""" -Example: Solve a GeeTest v4 challenge. +"""Example: Solve GeeTest v4 without a proxy. + +What it does: + This example shows how to solve GeeTest v4 without a proxy. It uses GeeTestTaskProxyless and CaptchaClient.solve(), returning captcha_output and related validation fields. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL and captcha_id from the target page. + STEP-03 - Create GeeTestTaskProxyless and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print captcha_output and related validation fields. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. @@ -28,10 +36,10 @@ from captcha_solver_api.tasks import GeeTestTaskProxyless # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/sync/image_to_text.py b/examples/sync/image_to_text.py index 892d693..efdf791 100644 --- a/examples/sync/image_to_text.py +++ b/examples/sync/image_to_text.py @@ -1,5 +1,13 @@ -""" -Example: Solve an Image to Text challenge. +"""Example: Recognize text in bundled local CAPTCHA images without a proxy. + +What it does: + This example shows how to recognize text in bundled local CAPTCHA images without a proxy. It uses ImageToTextTask and CaptchaClient.solve(), returning the recognized text. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. The images and answer-format hints come from examples/assets and this file. + STEP-03 - Create ImageToTextTask and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print the recognized text. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. @@ -28,10 +36,10 @@ from captcha_solver_api.tasks import ImageToTextTask # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/sync/recaptcha_v2_enterprise_proxy.py b/examples/sync/recaptcha_v2_enterprise_proxy.py index b2e5ba3..9e515e0 100644 --- a/examples/sync/recaptcha_v2_enterprise_proxy.py +++ b/examples/sync/recaptcha_v2_enterprise_proxy.py @@ -1,10 +1,19 @@ -""" -Example: Solve a reCAPTCHA v2 Enterprise challenge. +"""Example: Solve reCAPTCHA v2 Enterprise through your own proxy. + +What it does: + This example shows how to solve reCAPTCHA v2 Enterprise through your own proxy. It uses RecaptchaV2EnterpriseTask and CaptchaClient.solve(), returning a gRecaptchaResponse token. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL, websiteKey, and any enterprisePayload from the target page, and provide your proxy settings. + STEP-03 - Create RecaptchaV2EnterpriseTask and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print a gRecaptchaResponse token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. Replace websiteURL and websiteKey with values from your target page. If the site uses enterprisePayload, extract and pass it or the token may be rejected. + Replace the proxy placeholders with your own proxy settings. """ import os @@ -26,10 +35,10 @@ from captcha_solver_api.tasks import RecaptchaV2EnterpriseTask # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/sync/recaptcha_v2_enterprise_proxyless.py b/examples/sync/recaptcha_v2_enterprise_proxyless.py index bd7ebc5..01f5ccb 100644 --- a/examples/sync/recaptcha_v2_enterprise_proxyless.py +++ b/examples/sync/recaptcha_v2_enterprise_proxyless.py @@ -1,5 +1,13 @@ -""" -Example: Solve a reCAPTCHA v2 Enterprise challenge. +"""Example: Solve reCAPTCHA v2 Enterprise without a proxy. + +What it does: + This example shows how to solve reCAPTCHA v2 Enterprise without a proxy. It uses RecaptchaV2EnterpriseTaskProxyless and CaptchaClient.solve(), returning a gRecaptchaResponse token. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL, websiteKey, and any enterprisePayload from the target page. + STEP-03 - Create RecaptchaV2EnterpriseTaskProxyless and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print a gRecaptchaResponse token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. @@ -26,10 +34,10 @@ from captcha_solver_api.tasks import RecaptchaV2EnterpriseTaskProxyless # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/sync/recaptcha_v2_proxy.py b/examples/sync/recaptcha_v2_proxy.py index 40f6674..ff959ef 100644 --- a/examples/sync/recaptcha_v2_proxy.py +++ b/examples/sync/recaptcha_v2_proxy.py @@ -1,9 +1,18 @@ -""" -Example: Solve a reCAPTCHA v2 challenge. +"""Example: Solve reCAPTCHA v2 through your own proxy. + +What it does: + This example shows how to solve reCAPTCHA v2 through your own proxy. It uses RecaptchaV2Task and CaptchaClient.solve(), returning a gRecaptchaResponse token. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL and websiteKey from the target page and provide your proxy settings. + STEP-03 - Create RecaptchaV2Task and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print a gRecaptchaResponse token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. Replace websiteURL and websiteKey with values from your target page. + Replace the proxy placeholders with your own proxy settings. """ import os @@ -25,10 +34,10 @@ from captcha_solver_api.tasks import RecaptchaV2Task # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/sync/recaptcha_v2_proxyless.py b/examples/sync/recaptcha_v2_proxyless.py index 2670021..a0747dd 100644 --- a/examples/sync/recaptcha_v2_proxyless.py +++ b/examples/sync/recaptcha_v2_proxyless.py @@ -1,5 +1,13 @@ -""" -Example: Solve a reCAPTCHA v2 challenge. +"""Example: Solve reCAPTCHA v2 without a proxy. + +What it does: + This example shows how to solve reCAPTCHA v2 without a proxy. It uses RecaptchaV2TaskProxyless and CaptchaClient.solve(), returning a gRecaptchaResponse token. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL and websiteKey from the target page. + STEP-03 - Create RecaptchaV2TaskProxyless and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print a gRecaptchaResponse token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. @@ -25,10 +33,10 @@ from captcha_solver_api.tasks import RecaptchaV2TaskProxyless # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/sync/recaptcha_v3.py b/examples/sync/recaptcha_v3.py index cd2164b..2b143d7 100644 --- a/examples/sync/recaptcha_v3.py +++ b/examples/sync/recaptcha_v3.py @@ -1,11 +1,19 @@ -""" -Example: Solve a reCAPTCHA v3 challenge. +"""Example: Solve score-based reCAPTCHA v3 without a proxy. + +What it does: + This example shows how to solve score-based reCAPTCHA v3 without a proxy. It uses RecaptchaV3TaskProxyless and CaptchaClient.solve(), returning a gRecaptchaResponse token. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL, websiteKey, and pageAction from the target page, then choose the required minimum score. + STEP-03 - Create RecaptchaV3TaskProxyless and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print a gRecaptchaResponse token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. - Replace websiteURL, websiteKey, and minScore with values from your target - page, and pass pageAction if the site uses it -- this increases the - chance of the token being accepted. + Replace websiteURL and websiteKey with values from your target page, pass + pageAction if the site uses it, and choose the minimum score your + integration requires. """ import os @@ -27,10 +35,10 @@ from captcha_solver_api.tasks import RecaptchaV3TaskProxyless # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/sync/tencent_proxy.py b/examples/sync/tencent_proxy.py index 1314907..2bff730 100644 --- a/examples/sync/tencent_proxy.py +++ b/examples/sync/tencent_proxy.py @@ -1,10 +1,19 @@ -""" -Example: Solve a Tencent captcha challenge. +"""Example: Solve Tencent CAPTCHA through your own proxy. + +What it does: + This example shows how to solve Tencent CAPTCHA through your own proxy. It uses TencentTask and CaptchaClient.solve(), returning appid, ret, ticket, and randstr values. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL, appId, and any non-default captchaScript from the target page, then provide your proxy settings. + STEP-03 - Create TencentTask and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print appid, ret, ticket, and randstr values. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. Replace websiteURL and appId with values from your target page. Pass captchaScript if the site uses a non-default script URL. + Replace the proxy placeholders with your own proxy settings. """ import os diff --git a/examples/sync/tencent_proxyless.py b/examples/sync/tencent_proxyless.py index fd620bc..3387e92 100644 --- a/examples/sync/tencent_proxyless.py +++ b/examples/sync/tencent_proxyless.py @@ -1,5 +1,13 @@ -""" -Example: Solve a Tencent captcha challenge. +"""Example: Solve Tencent CAPTCHA without a proxy. + +What it does: + This example shows how to solve Tencent CAPTCHA without a proxy. It uses TencentTaskProxyless and CaptchaClient.solve(), returning appid, ret, ticket, and randstr values. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL, appId, and any non-default captchaScript from the target page. + STEP-03 - Create TencentTaskProxyless and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print appid, ret, ticket, and randstr values. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. diff --git a/examples/sync/turnstile_proxy.py b/examples/sync/turnstile_proxy.py index 29d61ac..16b3d1d 100644 --- a/examples/sync/turnstile_proxy.py +++ b/examples/sync/turnstile_proxy.py @@ -1,10 +1,19 @@ -""" -Example: Solve a Cloudflare Turnstile challenge. +"""Example: Solve Cloudflare Turnstile through your own proxy. + +What it does: + This example shows how to solve Cloudflare Turnstile through your own proxy. It uses TurnstileTask and CaptchaClient.solve(), returning a token. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL, websiteKey, and any Challenge-page action, data, and pagedata values, then provide your proxy settings. + STEP-03 - Create TurnstileTask and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print a token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. Replace websiteURL and websiteKey with values from your target page. For Cloudflare Challenge pages, also extract and pass action, data, and pagedata. + Replace the proxy placeholders with your own proxy settings. """ import os @@ -26,10 +35,10 @@ from captcha_solver_api.tasks import TurnstileTask # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/sync/turnstile_proxyless.py b/examples/sync/turnstile_proxyless.py index 258402d..7d7a0df 100644 --- a/examples/sync/turnstile_proxyless.py +++ b/examples/sync/turnstile_proxyless.py @@ -1,5 +1,13 @@ -""" -Example: Solve a Cloudflare Turnstile challenge. +"""Example: Solve Cloudflare Turnstile without a proxy. + +What it does: + This example shows how to solve Cloudflare Turnstile without a proxy. It uses TurnstileTaskProxyless and CaptchaClient.solve(), returning a token. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL, websiteKey, and any Challenge-page action, data, and pagedata values from the target page. + STEP-03 - Create TurnstileTaskProxyless and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print a token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. @@ -26,10 +34,10 @@ from captcha_solver_api.tasks import TurnstileTaskProxyless # in this example we store the API key inside environment variables that can be set like: -# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS -# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows +# export CAPTCHA_API_KEY=your_api_key on Linux or macOS +# set CAPTCHA_API_KEY=your_api_key on Windows # you can just set the API key directly to its value like: -# api_key="1abc234de56fab7c89012d34e56fa7b8" +# api_key="your_api_key" api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY") diff --git a/examples/sync/yandex_smartcaptcha_image.py b/examples/sync/yandex_smartcaptcha_image.py index 9973cdc..be93a52 100644 --- a/examples/sync/yandex_smartcaptcha_image.py +++ b/examples/sync/yandex_smartcaptcha_image.py @@ -1,4 +1,13 @@ -"""Example: Solve an image-based Yandex SmartCaptcha. +"""Example: Solve an image-based Yandex SmartCaptcha from bundled local images without a proxy. + +What it does: + This example shows how to solve an image-based Yandex SmartCaptcha from bundled local images without a proxy. It uses YandexSmartCaptchaImageTask and CaptchaClient.solve(), returning pixel coordinates to click. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. The challenge and instruction images come from examples/assets. + STEP-03 - Create YandexSmartCaptchaImageTask and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print pixel coordinates to click. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. diff --git a/examples/sync/yandex_smartcaptcha_kaleidoscope.py b/examples/sync/yandex_smartcaptcha_kaleidoscope.py index 694e2f9..574fa80 100644 --- a/examples/sync/yandex_smartcaptcha_kaleidoscope.py +++ b/examples/sync/yandex_smartcaptcha_kaleidoscope.py @@ -1,15 +1,13 @@ -"""Example: Solve an image-based Yandex SmartCaptcha Kaleidoscope puzzle. +"""Example: Solve a Yandex SmartCaptcha Kaleidoscope puzzle from a bundled local image without a proxy. -This example reads the bundled Kaleidoscope challenge image, encodes it as -Base64, sends it together with the puzzle-step sequence without a proxy, and -prints how many times to click the slider arrow. It uses -YandexSmartCaptchaKaleidoscopeTask and CaptchaClient.solve(). +What it does: + This example shows how to solve a Yandex SmartCaptcha Kaleidoscope puzzle from a bundled local image without a proxy. It uses YandexSmartCaptchaKaleidoscopeTask and CaptchaClient.solve(), returning the number of slider-arrow clicks. How it works: -STEP-01 - Configure CaptchaClient and locate the bundled challenge image. -STEP-02 - Encode the image and create a task with the captured puzzle steps. -STEP-03 - Call solve(), which creates the task and polls for its solution. -STEP-04 - Print the slider-arrow click count, or report the error. + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. The challenge image comes from examples/assets and the puzzle-step sequence is captured from the challenge. + STEP-03 - Create YandexSmartCaptchaKaleidoscopeTask and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print the number of slider-arrow clicks. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. diff --git a/examples/sync/yandex_smartcaptcha_proxy.py b/examples/sync/yandex_smartcaptcha_proxy.py index 08a2fc5..ebc1bd7 100644 --- a/examples/sync/yandex_smartcaptcha_proxy.py +++ b/examples/sync/yandex_smartcaptcha_proxy.py @@ -1,9 +1,18 @@ -""" -Example: Solve a Yandex SmartCaptcha challenge (token-based). +"""Example: Solve token-based Yandex SmartCaptcha through your own proxy. + +What it does: + This example shows how to solve token-based Yandex SmartCaptcha through your own proxy. It uses YandexSmartCaptchaTask and CaptchaClient.solve(), returning a token. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL and websiteKey from the target page and provide your proxy settings. + STEP-03 - Create YandexSmartCaptchaTask and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print a token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable. Replace websiteURL and websiteKey with values from your target page. + Replace the proxy placeholders with your own proxy settings. """ import os diff --git a/examples/sync/yandex_smartcaptcha_proxyless.py b/examples/sync/yandex_smartcaptcha_proxyless.py index af1b089..28c0bd3 100644 --- a/examples/sync/yandex_smartcaptcha_proxyless.py +++ b/examples/sync/yandex_smartcaptcha_proxyless.py @@ -1,5 +1,13 @@ -""" -Example: Solve a Yandex SmartCaptcha challenge (token-based). +"""Example: Solve token-based Yandex SmartCaptcha without a proxy. + +What it does: + This example shows how to solve token-based Yandex SmartCaptcha without a proxy. It uses YandexSmartCaptchaTaskProxyless and CaptchaClient.solve(), returning a token. + +How it works: + STEP-01 - Configure CaptchaClient with the API key. + STEP-02 - Obtain the task parameters. Extract websiteURL and websiteKey from the target page. + STEP-03 - Create YandexSmartCaptchaTaskProxyless and pass it to solver.solve(task), which creates and polls the task. + STEP-04 - Print a token. Applying the solution and verifying acceptance are target-specific. Prerequisites: Set the CAPTCHA_API_KEY environment variable.