Skip to content

Commit 4fda5fd

Browse files
committed
docs: expand example usage guides
1 parent e548eb4 commit 4fda5fd

40 files changed

Lines changed: 453 additions & 153 deletions

‎examples/async/balance.py‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
"""
2-
Example: Get account balance with the async client.
1+
"""Example: Check the current captcha solver account balance without creating a captcha task.
2+
3+
What it does:
4+
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.
5+
6+
How it works:
7+
STEP-01 - Configure AsyncCaptchaClient with the API key.
8+
STEP-02 - Call await solver.get_balance(); this does not create or poll a CAPTCHA task.
9+
STEP-03 - Print the balance returned by the API.
310
411
Prerequisites:
512
Set the CAPTCHA_API_KEY environment variable.
@@ -25,10 +32,10 @@
2532
from captcha_solver_api import AsyncCaptchaClient
2633

2734
# in this example we store the API key inside environment variables that can be set like:
28-
# export CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Linux or macOS
29-
# set CAPTCHA_API_KEY=1abc234de56fab7c89012d34e56fa7b8 on Windows
35+
# export CAPTCHA_API_KEY=your_api_key on Linux or macOS
36+
# set CAPTCHA_API_KEY=your_api_key on Windows
3037
# you can just set the API key directly to its value like:
31-
# api_key="1abc234de56fab7c89012d34e56fa7b8"
38+
# api_key="your_api_key"
3239

3340
api_key = os.getenv("CAPTCHA_API_KEY", "YOUR_API_KEY")
3441

‎examples/async/coordinates.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
"""
2-
Example: Solve a click-based image captcha using CoordinatesTask with the async client.
1+
"""Example: Solve click-based image captchas from bundled local images without a proxy.
2+
3+
What it does:
4+
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.
5+
6+
How it works:
7+
STEP-01 - Configure AsyncCaptchaClient with the API key.
8+
STEP-02 - Obtain the task parameters. The image, optional instruction image, and click hints come from examples/assets and this file.
9+
STEP-03 - Create CoordinatesTask and pass it to await solver.solve(task), which creates and polls the task.
10+
STEP-04 - Print pixel coordinates to click. Applying the solution and verifying acceptance are target-specific.
311
412
Prerequisites:
513
Set the CAPTCHA_API_KEY environment variable.

‎examples/async/geetest_v3_proxy.py‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1-
"""
2-
Example: Solve a GeeTest v3 challenge with the async client.
1+
"""Example: Solve GeeTest v3 through your own proxy.
2+
3+
What it does:
4+
This example shows how to solve GeeTest v3 through your own proxy. It uses GeeTestTask and AsyncCaptchaClient.solve(), returning challenge, validate, and seccode values.
5+
6+
How it works:
7+
STEP-01 - Configure AsyncCaptchaClient with the API key.
8+
STEP-02 - Obtain the task parameters. Extract the GeeTest values from the target page, fetch a fresh challenge, and provide your proxy settings.
9+
STEP-03 - Create GeeTestTask and pass it to await solver.solve(task), which creates and polls the task.
10+
STEP-04 - Print challenge, validate, and seccode values. Applying the solution and verifying acceptance are target-specific.
311
412
Prerequisites:
513
Set the CAPTCHA_API_KEY environment variable.
614
Replace websiteURL, gt, and challenge with values from your target page.
715
Important: the challenge value is dynamic. Fetch a fresh one for each request.
816
9-
NOTE: "https://target-site.com/path/to/geetest/init" below is a PLACEHOLDER, not a
10-
real endpoint -- this script will not run end-to-end as-is. Replace it with a request
11-
to your actual target page (or wherever it exposes a fresh `challenge` value) before
12-
running this example. It's here only to illustrate where that fetch belongs in the flow.
17+
NOTE: "https://target-site.com/path/to/geetest/init" below is a PLACEHOLDER, not a
18+
real endpoint -- this script will not run end-to-end as-is. Replace it with a request
19+
to your actual target page (or wherever it exposes a fresh `challenge` value) before
20+
running this example. It's here only to illustrate where that fetch belongs in the flow.
1321
"""
1422

1523
import asyncio

‎examples/async/geetest_v3_proxyless.py‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1-
"""
2-
Example: Solve a GeeTest v3 challenge with the async client.
1+
"""Example: Solve GeeTest v3 without a proxy.
2+
3+
What it does:
4+
This example shows how to solve GeeTest v3 without a proxy. It uses GeeTestTaskProxyless and AsyncCaptchaClient.solve(), returning challenge, validate, and seccode values.
5+
6+
How it works:
7+
STEP-01 - Configure AsyncCaptchaClient with the API key.
8+
STEP-02 - Obtain the task parameters. Extract websiteURL and gt from the target page and fetch a fresh challenge for every request.
9+
STEP-03 - Create GeeTestTaskProxyless and pass it to await solver.solve(task), which creates and polls the task.
10+
STEP-04 - Print challenge, validate, and seccode values. Applying the solution and verifying acceptance are target-specific.
311
412
Prerequisites:
513
Set the CAPTCHA_API_KEY environment variable.
614
Replace websiteURL, gt, and challenge with values from your target page.
715
Important: the challenge value is dynamic. Fetch a fresh one for each request.
816
9-
NOTE: "https://target-site.com/path/to/geetest/init" below is a PLACEHOLDER, not a
10-
real endpoint -- this script will not run end-to-end as-is. Replace it with a request
11-
to your actual target page (or wherever it exposes a fresh `challenge` value) before
12-
running this example. It's here only to illustrate where that fetch belongs in the flow.
17+
NOTE: "https://target-site.com/path/to/geetest/init" below is a PLACEHOLDER, not a
18+
real endpoint -- this script will not run end-to-end as-is. Replace it with a request
19+
to your actual target page (or wherever it exposes a fresh `challenge` value) before
20+
running this example. It's here only to illustrate where that fetch belongs in the flow.
1321
"""
1422

1523
import asyncio

‎examples/async/geetest_v4_proxy.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
"""
2-
Example: Solve a GeeTest v4 challenge with the async client.
1+
"""Example: Solve GeeTest v4 through your own proxy.
2+
3+
What it does:
4+
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.
5+
6+
How it works:
7+
STEP-01 - Configure AsyncCaptchaClient with the API key.
8+
STEP-02 - Obtain the task parameters. Extract websiteURL and captcha_id from the target page and provide your proxy settings.
9+
STEP-03 - Create GeeTestTask and pass it to await solver.solve(task), which creates and polls the task.
10+
STEP-04 - Print captcha_output and related validation fields. Applying the solution and verifying acceptance are target-specific.
311
412
Prerequisites:
513
Set the CAPTCHA_API_KEY environment variable.

‎examples/async/geetest_v4_proxyless.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
"""
2-
Example: Solve a GeeTest v4 challenge with the async client.
1+
"""Example: Solve GeeTest v4 without a proxy.
2+
3+
What it does:
4+
This example shows how to solve GeeTest v4 without a proxy. It uses GeeTestTaskProxyless and AsyncCaptchaClient.solve(), returning captcha_output and related validation fields.
5+
6+
How it works:
7+
STEP-01 - Configure AsyncCaptchaClient with the API key.
8+
STEP-02 - Obtain the task parameters. Extract websiteURL and captcha_id from the target page.
9+
STEP-03 - Create GeeTestTaskProxyless and pass it to await solver.solve(task), which creates and polls the task.
10+
STEP-04 - Print captcha_output and related validation fields. Applying the solution and verifying acceptance are target-specific.
311
412
Prerequisites:
513
Set the CAPTCHA_API_KEY environment variable.

‎examples/async/image_to_text.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
"""
2-
Example: Solve an image captcha with the async client.
1+
"""Example: Recognize text in bundled local captcha images without a proxy.
2+
3+
What it does:
4+
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.
5+
6+
How it works:
7+
STEP-01 - Configure AsyncCaptchaClient with the API key.
8+
STEP-02 - Obtain the task parameters. The images and answer-format hints come from examples/assets and this file.
9+
STEP-03 - Create ImageToTextTask and pass it to await solver.solve(task), which creates and polls the task.
10+
STEP-04 - Print the recognized text. Applying the solution and verifying acceptance are target-specific.
311
412
Prerequisites:
513
Set the CAPTCHA_API_KEY environment variable.

‎examples/async/recaptcha_v2_enterprise_proxy.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
"""
2-
Example: Solve a reCAPTCHA v2 Enterprise challenge with the async client.
1+
"""Example: Solve reCAPTCHA v2 enterprise through your own proxy.
2+
3+
What it does:
4+
This example shows how to solve reCAPTCHA v2 Enterprise through your own proxy. It uses RecaptchaV2EnterpriseTask and AsyncCaptchaClient.solve(), returning a gRecaptchaResponse token.
5+
6+
How it works:
7+
STEP-01 - Configure AsyncCaptchaClient with the API key.
8+
STEP-02 - Obtain the task parameters. Extract websiteURL, websiteKey, and any enterprisePayload from the target page, and provide your proxy settings.
9+
STEP-03 - Create RecaptchaV2EnterpriseTask and pass it to await solver.solve(task), which creates and polls the task.
10+
STEP-04 - Print a gRecaptchaResponse token. Applying the solution and verifying acceptance are target-specific.
311
412
Prerequisites:
513
Set the CAPTCHA_API_KEY environment variable.

‎examples/async/recaptcha_v2_enterprise_proxyless.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
"""
2-
Example: Solve a reCAPTCHA v2 Enterprise challenge with the async client.
1+
"""Example: Solve reCAPTCHA v2 enterprise without a proxy.
2+
3+
What it does:
4+
This example shows how to solve reCAPTCHA v2 Enterprise without a proxy. It uses RecaptchaV2EnterpriseTaskProxyless and AsyncCaptchaClient.solve(), returning a gRecaptchaResponse token.
5+
6+
How it works:
7+
STEP-01 - Configure AsyncCaptchaClient with the API key.
8+
STEP-02 - Obtain the task parameters. Extract websiteURL, websiteKey, and any enterprisePayload from the target page.
9+
STEP-03 - Create RecaptchaV2EnterpriseTaskProxyless and pass it to await solver.solve(task), which creates and polls the task.
10+
STEP-04 - Print a gRecaptchaResponse token. Applying the solution and verifying acceptance are target-specific.
311
412
Prerequisites:
513
Set the CAPTCHA_API_KEY environment variable.

‎examples/async/recaptcha_v2_proxy.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
"""
2-
Example: Solve a reCAPTCHA v2 challenge through your own proxy with the async client.
1+
"""Example: Solve reCAPTCHA v2 through your own proxy.
2+
3+
What it does:
4+
This example shows how to solve reCAPTCHA v2 through your own proxy. It uses RecaptchaV2Task and AsyncCaptchaClient.solve(), returning a gRecaptchaResponse token.
5+
6+
How it works:
7+
STEP-01 - Configure AsyncCaptchaClient with the API key.
8+
STEP-02 - Obtain the task parameters. Extract websiteURL and websiteKey from the target page and provide your proxy settings.
9+
STEP-03 - Create RecaptchaV2Task and pass it to await solver.solve(task), which creates and polls the task.
10+
STEP-04 - Print a gRecaptchaResponse token. Applying the solution and verifying acceptance are target-specific.
311
412
Prerequisites:
513
Set the CAPTCHA_API_KEY environment variable.

0 commit comments

Comments
 (0)