Skip to content

Commit 9a58aea

Browse files
committed
fix: match 2Captcha polling interval
1 parent 65a69b8 commit 9a58aea

6 files changed

Lines changed: 11 additions & 10 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Constructor.
121121
| `client_key` | `str` | required | Your Captcha Solver API key. Raises `ValidationError` if empty. |
122122
| `base_url` | `str` | `https://api.captcha-solver.com` | API base URL. Override only for self-hosted/staging deployments. |
123123
| `timeout` | `int` | `120` | Polling window after task creation, in seconds. Overridable per call; each HTTP request has a separate 30-second timeout. |
124-
| `polling_interval` | `int` | `5` | Seconds before the first `getTaskResult` poll and between subsequent polls, matching the API recommendation. |
124+
| `polling_interval` | `int` | `10` | Seconds before the first `getTaskResult` poll and between subsequent polls, matching the official 2Captcha Python SDK. |
125125
| `language_pool` | `Optional[str]` | `None` | Default worker pool (`"en"` or `"ru"`) applied to every call that doesn't pass its own `language_pool`. |
126126

127127
Both clients hold a reusable connection pool (`requests.Session` / `httpx.AsyncClient`)
@@ -567,8 +567,9 @@ it for every other call:
567567
result = client.solve(task, timeout=300)
568568
```
569569

570-
The [API recommends polling every 5 seconds](https://captcha-solver.com/en/docs/how-it-works).
571-
`solve()` waits for `polling_interval` before its first poll and between polls.
570+
The [API requires at least 5 seconds between polls](https://captcha-solver.com/en/docs/how-it-works).
571+
The SDK defaults to 10 seconds, like the official 2Captcha Python SDK. `solve()`
572+
waits for `polling_interval` before its first poll and between polls.
572573
Its default 120-second polling window is independent of the API's five-minute
573574
task lifetime. A local timeout does not cancel a task or mean that the API
574575
failed to solve it. Use `create_task()` and keep its `task_id` if you need to

‎captcha_solver_api/async_client.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(
4242
client_key: str,
4343
base_url: str = "https://api.captcha-solver.com",
4444
timeout: int = 120,
45-
polling_interval: int = 5,
45+
polling_interval: int = 10,
4646
language_pool: Optional[str] = None,
4747
) -> None:
4848
"""
@@ -54,7 +54,7 @@ def __init__(
5454
raising `CaptchaTimeoutError`. Can be overridden per call.
5555
polling_interval: Seconds to wait before the first `getTaskResult`
5656
poll and between subsequent polls inside `solve()`. Defaults
57-
to the API's recommended interval of 5 seconds.
57+
to 10 seconds, matching the official 2Captcha Python SDK.
5858
language_pool: Default worker pool selector (e.g. `"en"` or `"ru"`)
5959
applied to every `create_task()`/`solve()` call that doesn't pass
6060
its own `language_pool`. Leave unset to use the account's default

‎captcha_solver_api/client.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __init__(
3131
client_key: str,
3232
base_url: str = "https://api.captcha-solver.com",
3333
timeout: int = 120,
34-
polling_interval: int = 5,
34+
polling_interval: int = 10,
3535
language_pool: Optional[str] = None,
3636
) -> None:
3737
"""
@@ -43,7 +43,7 @@ def __init__(
4343
raising `CaptchaTimeoutError`. Can be overridden per call.
4444
polling_interval: Seconds to wait before the first `getTaskResult`
4545
poll and between subsequent polls inside `solve()`. Defaults
46-
to the API's recommended interval of 5 seconds.
46+
to 10 seconds, matching the official 2Captcha Python SDK.
4747
language_pool: Default worker pool selector (e.g. `"en"` or `"ru"`)
4848
applied to every `create_task()`/`solve()` call that doesn't pass
4949
its own `language_pool`. Leave unset to use the account's default

‎examples/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ Async scripts create an `AsyncCaptchaClient` and await the same operations as th
8686
- Files using `*Task` instead of `*TaskProxyless` demonstrate solving through your own proxy. Supply valid proxy settings for your account.
8787
- For task parameters and response formats, see the [CAPTCHA type documentation](https://captcha-solver.com/en/docs/captcha-types).
8888
- For client methods and errors, see the [main README](../README.md#client-reference).
89-
- The default polling interval is 5 seconds, including the wait before the first poll. The default polling timeout is 120 seconds; use `solve(task, timeout=300)` for a longer wait. A timeout does not cancel the server's task.
89+
- The default polling interval is 10 seconds, including the wait before the first poll. The default polling timeout is 120 seconds; use `solve(task, timeout=300)` for a longer wait. A timeout does not cancel the server's task.

‎examples/sync/recaptcha_v2.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
# Create a solver instance with your API key.
3636
# Optional: timeout (max seconds to wait for solution, default 120)
37-
# Optional: polling_interval (seconds before and between status checks, default 5)
37+
# Optional: polling_interval (seconds before and between status checks, default 10)
3838
solver = CaptchaClient(api_key)
3939

4040
# --- Proxyless example ---

‎tests/test_polling.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def sleep(self, seconds):
2323

2424

2525
CASES = [
26-
(None, 20, [5, 10], False),
26+
(None, 25, [10, 20], False),
2727
(2, 20, [2, 4], False),
2828
(None, 3, [], True),
2929
(5, 7, [5], True),

0 commit comments

Comments
 (0)