capmonster-python 5.0.0__tar.gz → 5.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {capmonster_python-5.0.0/src/capmonster_python.egg-info → capmonster_python-5.1.0}/PKG-INFO +25 -10
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/README.md +16 -8
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/pyproject.toml +31 -3
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/__init__.py +15 -0
- capmonster_python-5.1.0/src/capmonster_python/_deprecation.py +24 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/client.py +96 -14
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/methods.py +20 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/__init__.py +21 -2
- capmonster_python-5.1.0/src/capmonster_python/tasks/alibaba.py +69 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/arcaptcha.py +23 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/castle.py +7 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/complex_image_recognition.py +57 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/datadome.py +8 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/fengkongcloud.py +39 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/friendly.py +43 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/funcaptcha.py +5 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/heytap.py +40 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/hunt.py +80 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/imperva.py +83 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/proton.py +40 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/recaptcha_click.py +8 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/recaptcha_v2_enterprise.py +2 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/temu.py +7 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/tendi.py +18 -2
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/turnstile.py +5 -7
- {capmonster_python-5.0.0 → capmonster_python-5.1.0/src/capmonster_python.egg-info}/PKG-INFO +25 -10
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python.egg-info/SOURCES.txt +7 -0
- capmonster_python-5.0.0/src/capmonster_python/tasks/complex_image_recognition.py +0 -33
- capmonster_python-5.0.0/src/capmonster_python/tasks/hunt.py +0 -27
- capmonster_python-5.0.0/src/capmonster_python/tasks/imperva.py +0 -50
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/LICENSE +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/setup.cfg +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/exceptions.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/altcha.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/amazon.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/basilisk.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/binance.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/complex_image_recaptcha.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/geetest.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/image_to_text.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/mtcaptcha.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/prosopo.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/recaptcha_v2.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/recaptcha_v3.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/recaptcha_v3_enterprise.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/task.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/tspd.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/yidun.py +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python.egg-info/dependency_links.txt +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python.egg-info/requires.txt +0 -0
- {capmonster_python-5.0.0 → capmonster_python-5.1.0}/src/capmonster_python.egg-info/top_level.txt +0 -0
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: capmonster_python
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.1.0
|
|
4
4
|
Summary: capmonster.cloud library/package for Python
|
|
5
5
|
Author-email: Alperen Sert <business@alperen.io>
|
|
6
6
|
License: MIT
|
|
7
7
|
Project-URL: Documentation, https://alperensert.github.io/capmonster_python/
|
|
8
8
|
Project-URL: Source, https://github.com/alperensert/capmonster_python/
|
|
9
9
|
Project-URL: Tracker, https://github.com/alperensert/capmonster_python/issues
|
|
10
|
-
|
|
10
|
+
Keywords: capmonster,capmonster-cloud,captcha,captcha-solver,captcha-solving,captcha-bypass,recaptcha,recaptcha-v2,recaptcha-v3,hcaptcha,turnstile,cloudflare,funcaptcha,geetest,datadome,image-captcha,web-scraping,async,python
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Framework :: AsyncIO
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
12
16
|
Classifier: Programming Language :: Python :: 3
|
|
13
17
|
Classifier: Programming Language :: Python :: 3.9
|
|
14
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
16
23
|
Requires-Python: >=3.9
|
|
17
24
|
Description-Content-Type: text/markdown
|
|
18
25
|
License-File: LICENSE
|
|
@@ -109,6 +116,8 @@ CapmonsterClient(api_key, timeout=30.0, max_retries=120, retry_delay=2.0)
|
|
|
109
116
|
| `create_task(task)` | Create a task, returns `task_id` |
|
|
110
117
|
| `join_task_result(task_id)` | Poll until result is ready |
|
|
111
118
|
| `get_task_result(task_id)` | Single poll (no waiting) |
|
|
119
|
+
| `solve_detailed(task)` | Like `solve`, but returns a `TaskResult` with `solution` and `cost` |
|
|
120
|
+
| `join_task_result_detailed(task_id)` / `get_task_result_detailed(task_id)` | Same, for polling |
|
|
112
121
|
| `get_balance()` | Get account balance |
|
|
113
122
|
| `get_user_agent()` | Get current valid User-Agent string |
|
|
114
123
|
| `report_incorrect_image(task_id)` | Report bad image captcha solution |
|
|
@@ -128,14 +137,14 @@ Both sync and async context managers are supported for proper connection cleanup
|
|
|
128
137
|
| reCAPTCHA v2 Enterprise | `RecaptchaV2EnterpriseTask` | Optional |
|
|
129
138
|
| reCAPTCHA v3 | `RecaptchaV3Task` | No |
|
|
130
139
|
| reCAPTCHA v3 Enterprise | `RecaptchaV3EnterpriseTask` | No |
|
|
131
|
-
| reCAPTCHA Click | `RecaptchaClickTask` | Optional |
|
|
140
|
+
| reCAPTCHA Click | `RecaptchaClickTask` (deprecated, use `ComplexImageRecaptchaTask`) | Optional |
|
|
132
141
|
|
|
133
142
|
### Cloudflare
|
|
134
143
|
|
|
135
144
|
| CAPTCHA Type | Class | Proxy |
|
|
136
145
|
|---|---|---|
|
|
137
146
|
| Turnstile | `TurnstileTask` | No |
|
|
138
|
-
| Turnstile Challenge (cf_clearance) | `TurnstileCloudFlareTask` | Required |
|
|
147
|
+
| Turnstile Challenge (token / cf_clearance) | `TurnstileCloudFlareTask` | Optional / Required |
|
|
139
148
|
| Turnstile Waiting Room | `TurnstileWaitingRoomTask` | Required |
|
|
140
149
|
|
|
141
150
|
### Image-Based
|
|
@@ -143,7 +152,7 @@ Both sync and async context managers are supported for proper connection cleanup
|
|
|
143
152
|
| CAPTCHA Type | Class | Proxy |
|
|
144
153
|
|---|---|---|
|
|
145
154
|
| Image-to-Text OCR | `ImageToTextTask` | No |
|
|
146
|
-
| Complex Image (reCAPTCHA grid) | `ComplexImageRecaptchaTask` | No |
|
|
155
|
+
| Complex Image (reCAPTCHA click/grid) | `ComplexImageRecaptchaTask` | No |
|
|
147
156
|
| Complex Image Recognition | `ComplexImageRecognitionTask` | No |
|
|
148
157
|
|
|
149
158
|
### Behavioral / Interactive
|
|
@@ -152,8 +161,11 @@ Both sync and async context managers are supported for proper connection cleanup
|
|
|
152
161
|
|---|---|---|
|
|
153
162
|
| GeeTest v3 | `GeeTestV3Task` | Optional |
|
|
154
163
|
| GeeTest v4 | `GeeTestV4Task` | Optional |
|
|
155
|
-
| FunCaptcha (Arkose Labs) | `FunCaptchaTask` |
|
|
156
|
-
| Hunt | `HuntTask` |
|
|
164
|
+
| FunCaptcha (Arkose Labs) | `FunCaptchaTask` | Required |
|
|
165
|
+
| Hunt | `HuntTask` | Required |
|
|
166
|
+
| Alibaba | `AlibabaTask` | Optional |
|
|
167
|
+
| Friendly Captcha | `FriendlyTask` | Optional |
|
|
168
|
+
| ARCaptcha | `ARCaptchaTask` | No |
|
|
157
169
|
|
|
158
170
|
### Enterprise Protection
|
|
159
171
|
|
|
@@ -169,8 +181,11 @@ Both sync and async context managers are supported for proper connection cleanup
|
|
|
169
181
|
| CAPTCHA Type | Class | Proxy |
|
|
170
182
|
|---|---|---|
|
|
171
183
|
| Binance | `BinanceTask` | Required |
|
|
172
|
-
| Temu | `TemuTask` | No |
|
|
173
|
-
| TenDI | `TenDITask` |
|
|
184
|
+
| Temu | `TemuTask` (deprecated) | No |
|
|
185
|
+
| TenDI | `TenDITask` | Optional |
|
|
186
|
+
| FengkongCloud | `FengkongCloudTask` | No |
|
|
187
|
+
| HeyTap | `HeyTapTask` | No |
|
|
188
|
+
| Proton | `ProtonTask` | Required |
|
|
174
189
|
|
|
175
190
|
### Other
|
|
176
191
|
|
|
@@ -178,7 +193,7 @@ Both sync and async context managers are supported for proper connection cleanup
|
|
|
178
193
|
|---|---|---|
|
|
179
194
|
| Altcha | `AltchaTask` | No |
|
|
180
195
|
| Basilisk | `BasiliskTask` | No |
|
|
181
|
-
| Castle | `CastleTask` | No |
|
|
196
|
+
| Castle | `CastleTask` (deprecated) | No |
|
|
182
197
|
| MTCaptcha | `MTCaptchaTask` | Optional |
|
|
183
198
|
| Prosopo | `ProsopoTask` | Optional |
|
|
184
199
|
| Yidun | `YidunTask` | Optional |
|
|
@@ -87,6 +87,8 @@ CapmonsterClient(api_key, timeout=30.0, max_retries=120, retry_delay=2.0)
|
|
|
87
87
|
| `create_task(task)` | Create a task, returns `task_id` |
|
|
88
88
|
| `join_task_result(task_id)` | Poll until result is ready |
|
|
89
89
|
| `get_task_result(task_id)` | Single poll (no waiting) |
|
|
90
|
+
| `solve_detailed(task)` | Like `solve`, but returns a `TaskResult` with `solution` and `cost` |
|
|
91
|
+
| `join_task_result_detailed(task_id)` / `get_task_result_detailed(task_id)` | Same, for polling |
|
|
90
92
|
| `get_balance()` | Get account balance |
|
|
91
93
|
| `get_user_agent()` | Get current valid User-Agent string |
|
|
92
94
|
| `report_incorrect_image(task_id)` | Report bad image captcha solution |
|
|
@@ -106,14 +108,14 @@ Both sync and async context managers are supported for proper connection cleanup
|
|
|
106
108
|
| reCAPTCHA v2 Enterprise | `RecaptchaV2EnterpriseTask` | Optional |
|
|
107
109
|
| reCAPTCHA v3 | `RecaptchaV3Task` | No |
|
|
108
110
|
| reCAPTCHA v3 Enterprise | `RecaptchaV3EnterpriseTask` | No |
|
|
109
|
-
| reCAPTCHA Click | `RecaptchaClickTask` | Optional |
|
|
111
|
+
| reCAPTCHA Click | `RecaptchaClickTask` (deprecated, use `ComplexImageRecaptchaTask`) | Optional |
|
|
110
112
|
|
|
111
113
|
### Cloudflare
|
|
112
114
|
|
|
113
115
|
| CAPTCHA Type | Class | Proxy |
|
|
114
116
|
|---|---|---|
|
|
115
117
|
| Turnstile | `TurnstileTask` | No |
|
|
116
|
-
| Turnstile Challenge (cf_clearance) | `TurnstileCloudFlareTask` | Required |
|
|
118
|
+
| Turnstile Challenge (token / cf_clearance) | `TurnstileCloudFlareTask` | Optional / Required |
|
|
117
119
|
| Turnstile Waiting Room | `TurnstileWaitingRoomTask` | Required |
|
|
118
120
|
|
|
119
121
|
### Image-Based
|
|
@@ -121,7 +123,7 @@ Both sync and async context managers are supported for proper connection cleanup
|
|
|
121
123
|
| CAPTCHA Type | Class | Proxy |
|
|
122
124
|
|---|---|---|
|
|
123
125
|
| Image-to-Text OCR | `ImageToTextTask` | No |
|
|
124
|
-
| Complex Image (reCAPTCHA grid) | `ComplexImageRecaptchaTask` | No |
|
|
126
|
+
| Complex Image (reCAPTCHA click/grid) | `ComplexImageRecaptchaTask` | No |
|
|
125
127
|
| Complex Image Recognition | `ComplexImageRecognitionTask` | No |
|
|
126
128
|
|
|
127
129
|
### Behavioral / Interactive
|
|
@@ -130,8 +132,11 @@ Both sync and async context managers are supported for proper connection cleanup
|
|
|
130
132
|
|---|---|---|
|
|
131
133
|
| GeeTest v3 | `GeeTestV3Task` | Optional |
|
|
132
134
|
| GeeTest v4 | `GeeTestV4Task` | Optional |
|
|
133
|
-
| FunCaptcha (Arkose Labs) | `FunCaptchaTask` |
|
|
134
|
-
| Hunt | `HuntTask` |
|
|
135
|
+
| FunCaptcha (Arkose Labs) | `FunCaptchaTask` | Required |
|
|
136
|
+
| Hunt | `HuntTask` | Required |
|
|
137
|
+
| Alibaba | `AlibabaTask` | Optional |
|
|
138
|
+
| Friendly Captcha | `FriendlyTask` | Optional |
|
|
139
|
+
| ARCaptcha | `ARCaptchaTask` | No |
|
|
135
140
|
|
|
136
141
|
### Enterprise Protection
|
|
137
142
|
|
|
@@ -147,8 +152,11 @@ Both sync and async context managers are supported for proper connection cleanup
|
|
|
147
152
|
| CAPTCHA Type | Class | Proxy |
|
|
148
153
|
|---|---|---|
|
|
149
154
|
| Binance | `BinanceTask` | Required |
|
|
150
|
-
| Temu | `TemuTask` | No |
|
|
151
|
-
| TenDI | `TenDITask` |
|
|
155
|
+
| Temu | `TemuTask` (deprecated) | No |
|
|
156
|
+
| TenDI | `TenDITask` | Optional |
|
|
157
|
+
| FengkongCloud | `FengkongCloudTask` | No |
|
|
158
|
+
| HeyTap | `HeyTapTask` | No |
|
|
159
|
+
| Proton | `ProtonTask` | Required |
|
|
152
160
|
|
|
153
161
|
### Other
|
|
154
162
|
|
|
@@ -156,7 +164,7 @@ Both sync and async context managers are supported for proper connection cleanup
|
|
|
156
164
|
|---|---|---|
|
|
157
165
|
| Altcha | `AltchaTask` | No |
|
|
158
166
|
| Basilisk | `BasiliskTask` | No |
|
|
159
|
-
| Castle | `CastleTask` | No |
|
|
167
|
+
| Castle | `CastleTask` (deprecated) | No |
|
|
160
168
|
| MTCaptcha | `MTCaptchaTask` | Optional |
|
|
161
169
|
| Prosopo | `ProsopoTask` | Optional |
|
|
162
170
|
| Yidun | `YidunTask` | Optional |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "capmonster_python"
|
|
3
|
-
version = "5.
|
|
3
|
+
version = "5.1.0"
|
|
4
4
|
description = "capmonster.cloud library/package for Python"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.9"
|
|
@@ -11,13 +11,41 @@ dependencies = [
|
|
|
11
11
|
"pydantic>=2.0"
|
|
12
12
|
]
|
|
13
13
|
|
|
14
|
+
keywords = [
|
|
15
|
+
"capmonster",
|
|
16
|
+
"capmonster-cloud",
|
|
17
|
+
"captcha",
|
|
18
|
+
"captcha-solver",
|
|
19
|
+
"captcha-solving",
|
|
20
|
+
"captcha-bypass",
|
|
21
|
+
"recaptcha",
|
|
22
|
+
"recaptcha-v2",
|
|
23
|
+
"recaptcha-v3",
|
|
24
|
+
"hcaptcha",
|
|
25
|
+
"turnstile",
|
|
26
|
+
"cloudflare",
|
|
27
|
+
"funcaptcha",
|
|
28
|
+
"geetest",
|
|
29
|
+
"datadome",
|
|
30
|
+
"image-captcha",
|
|
31
|
+
"web-scraping",
|
|
32
|
+
"async",
|
|
33
|
+
"python",
|
|
34
|
+
]
|
|
35
|
+
|
|
14
36
|
classifiers = [
|
|
15
|
-
"Development Status ::
|
|
37
|
+
"Development Status :: 5 - Production/Stable",
|
|
16
38
|
"License :: OSI Approved :: MIT License",
|
|
39
|
+
"Framework :: AsyncIO",
|
|
40
|
+
"Intended Audience :: Developers",
|
|
41
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
17
42
|
"Programming Language :: Python :: 3",
|
|
18
43
|
"Programming Language :: Python :: 3.9",
|
|
19
44
|
"Programming Language :: Python :: 3.10",
|
|
20
|
-
"Programming Language :: Python :: 3.11"
|
|
45
|
+
"Programming Language :: Python :: 3.11",
|
|
46
|
+
"Programming Language :: Python :: 3.12",
|
|
47
|
+
"Programming Language :: Python :: 3.13",
|
|
48
|
+
"Operating System :: OS Independent",
|
|
21
49
|
]
|
|
22
50
|
|
|
23
51
|
[project.urls]
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
from .client import CapmonsterClient
|
|
2
|
+
from .methods import TaskResult
|
|
2
3
|
from .exceptions import *
|
|
3
4
|
from .tasks import *
|
|
4
5
|
|
|
5
6
|
__all__ = [
|
|
6
7
|
"CapmonsterClient",
|
|
8
|
+
"TaskResult",
|
|
7
9
|
"VanillaTaskPayload",
|
|
8
10
|
"ProxyPayload",
|
|
9
11
|
"UserAgentPayload",
|
|
12
|
+
"AlibabaTask",
|
|
13
|
+
"AlibabaMetadata",
|
|
10
14
|
"AltchaTask",
|
|
11
15
|
"AltchaMetadata",
|
|
12
16
|
"AmazonTask",
|
|
17
|
+
"ARCaptchaTask",
|
|
13
18
|
"BasiliskTask",
|
|
14
19
|
"BinanceTask",
|
|
15
20
|
"CastleTask",
|
|
@@ -19,15 +24,24 @@ __all__ = [
|
|
|
19
24
|
"ComplexImageRecognitionTask",
|
|
20
25
|
"DataDomeTask",
|
|
21
26
|
"DataDomeMetadata",
|
|
27
|
+
"FengkongCloudTask",
|
|
28
|
+
"FengkongCloudMetadata",
|
|
29
|
+
"FriendlyTask",
|
|
30
|
+
"FriendlyMetadata",
|
|
22
31
|
"FunCaptchaTask",
|
|
23
32
|
"GeeTestV3Task",
|
|
24
33
|
"GeeTestV4Task",
|
|
34
|
+
"HeyTapTask",
|
|
35
|
+
"HeyTapMetadata",
|
|
25
36
|
"HuntTask",
|
|
37
|
+
"HuntMetadata",
|
|
26
38
|
"ImageToTextTask",
|
|
27
39
|
"ImpervaTask",
|
|
28
40
|
"ImpervaTaskMetadata",
|
|
29
41
|
"MTCaptchaTask",
|
|
30
42
|
"ProsopoTask",
|
|
43
|
+
"ProtonTask",
|
|
44
|
+
"ProtonMetadata",
|
|
31
45
|
"RecaptchaClickTask",
|
|
32
46
|
"RecaptchaV2Task",
|
|
33
47
|
"RecaptchaV2EnterpriseTask",
|
|
@@ -35,6 +49,7 @@ __all__ = [
|
|
|
35
49
|
"RecaptchaV3EnterpriseTask",
|
|
36
50
|
"TemuTask",
|
|
37
51
|
"TenDITask",
|
|
52
|
+
"TenDIMetadata",
|
|
38
53
|
"TSPDTask",
|
|
39
54
|
"TSPDMetadata",
|
|
40
55
|
"TurnstileTask",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import warnings
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def warn_deprecated(message: str, stacklevel: int = 3) -> None:
|
|
5
|
+
"""
|
|
6
|
+
Emits a DeprecationWarning pointing at the caller's code.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
message: What is deprecated and what to use instead.
|
|
10
|
+
stacklevel: How many frames up the warning should point to.
|
|
11
|
+
"""
|
|
12
|
+
warnings.warn(message, DeprecationWarning, stacklevel=stacklevel)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def warn_proxy_required(task: str, stacklevel: int = 3) -> None:
|
|
16
|
+
"""
|
|
17
|
+
Emits a UserWarning when a task that the API documents as proxy-only is created without a proxy.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
task: Name of the task class.
|
|
21
|
+
stacklevel: How many frames up the warning should point to.
|
|
22
|
+
"""
|
|
23
|
+
warnings.warn(f"{task}: CapMonster Cloud requires your own proxy for this task; "
|
|
24
|
+
f"the request will likely be rejected without one.", UserWarning, stacklevel=stacklevel)
|
|
@@ -5,7 +5,8 @@ from typing import Optional
|
|
|
5
5
|
from httpx import Response, AsyncClient, Client
|
|
6
6
|
|
|
7
7
|
from .exceptions import CapmonsterAPIException, CapmonsterException
|
|
8
|
-
from .methods import GetBalancePayload, GetTaskResultPayload, CreateTaskPayload, ReportIncorrectCaptchaPayload
|
|
8
|
+
from .methods import GetBalancePayload, GetTaskResultPayload, CreateTaskPayload, ReportIncorrectCaptchaPayload, \
|
|
9
|
+
TaskResult
|
|
9
10
|
from .tasks.task import TaskPayload
|
|
10
11
|
|
|
11
12
|
|
|
@@ -140,9 +141,22 @@ class CapmonsterClient:
|
|
|
140
141
|
result API endpoint. If the solution is not found in the response, an empty
|
|
141
142
|
dictionary is returned.
|
|
142
143
|
"""
|
|
144
|
+
return self.get_task_result_detailed(task_id).solution
|
|
145
|
+
|
|
146
|
+
def get_task_result_detailed(self, task_id: int) -> TaskResult:
|
|
147
|
+
"""
|
|
148
|
+
Fetches the full result of a specific task by its identifier, including its status and cost.
|
|
149
|
+
|
|
150
|
+
Args:
|
|
151
|
+
task_id (int): An integer representing the unique identifier of the task.
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
TaskResult: The status, solution and cost of the task. The solution is an empty
|
|
155
|
+
dictionary and the cost is None while the task is processing.
|
|
156
|
+
"""
|
|
143
157
|
payload = GetTaskResultPayload(clientKey=self.api_key, taskId=task_id).model_dump()
|
|
144
158
|
response = self.__make_sync_request(self.__TASK_RESULT_URL, payload).json()
|
|
145
|
-
return
|
|
159
|
+
return TaskResult.from_response(response)
|
|
146
160
|
|
|
147
161
|
async def get_task_result_async(self, task_id: int) -> dict:
|
|
148
162
|
"""
|
|
@@ -162,10 +176,22 @@ class CapmonsterClient:
|
|
|
162
176
|
result API endpoint. If the solution is not found in the response, an empty
|
|
163
177
|
dictionary is returned.
|
|
164
178
|
"""
|
|
179
|
+
return (await self.get_task_result_detailed_async(task_id)).solution
|
|
180
|
+
|
|
181
|
+
async def get_task_result_detailed_async(self, task_id: int) -> TaskResult:
|
|
182
|
+
"""
|
|
183
|
+
Asynchronously fetches the full result of a specific task by its identifier, including its status and cost.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
task_id (int): An integer representing the unique identifier of the task.
|
|
187
|
+
|
|
188
|
+
Returns:
|
|
189
|
+
TaskResult: The status, solution and cost of the task. The solution is an empty
|
|
190
|
+
dictionary and the cost is None while the task is processing.
|
|
191
|
+
"""
|
|
165
192
|
payload = GetTaskResultPayload(clientKey=self.api_key, taskId=task_id).model_dump()
|
|
166
193
|
request = await self.__make_async_request(self.__TASK_RESULT_URL, payload)
|
|
167
|
-
|
|
168
|
-
return response.get("solution", {})
|
|
194
|
+
return TaskResult.from_response(request.json())
|
|
169
195
|
|
|
170
196
|
def join_task_result(self, task_id: int) -> dict:
|
|
171
197
|
"""
|
|
@@ -179,16 +205,31 @@ class CapmonsterClient:
|
|
|
179
205
|
dict:
|
|
180
206
|
The result of the task if successfully retrieved within the maximum retries.
|
|
181
207
|
|
|
208
|
+
Raises:
|
|
209
|
+
CapmonsterException:
|
|
210
|
+
If the maximum retry limit is exceeded without obtaining the task result.
|
|
211
|
+
"""
|
|
212
|
+
return self.join_task_result_detailed(task_id).solution
|
|
213
|
+
|
|
214
|
+
def join_task_result_detailed(self, task_id: int) -> TaskResult:
|
|
215
|
+
"""
|
|
216
|
+
Polls the result of a task like `join_task_result`, but returns its status and cost too.
|
|
217
|
+
|
|
218
|
+
Args:
|
|
219
|
+
task_id: The identifier of the task for which the result needs to be retrieved.
|
|
220
|
+
|
|
221
|
+
Returns:
|
|
222
|
+
TaskResult: The status, solution and cost of the completed task.
|
|
223
|
+
|
|
182
224
|
Raises:
|
|
183
225
|
CapmonsterException:
|
|
184
226
|
If the maximum retry limit is exceeded without obtaining the task result.
|
|
185
227
|
"""
|
|
186
228
|
for _ in range(0, self.__max_retries + 1):
|
|
187
|
-
result = self.
|
|
188
|
-
if result:
|
|
229
|
+
result = self.get_task_result_detailed(task_id)
|
|
230
|
+
if result.solution:
|
|
189
231
|
return result
|
|
190
|
-
|
|
191
|
-
sleep(self.__retry_delay)
|
|
232
|
+
sleep(self.__retry_delay)
|
|
192
233
|
raise CapmonsterAPIException(
|
|
193
234
|
61, "ERROR_MAXIMUM_TIME_EXCEED", "Maximum time is exceed.")
|
|
194
235
|
|
|
@@ -204,16 +245,31 @@ class CapmonsterClient:
|
|
|
204
245
|
dict:
|
|
205
246
|
The result of the task if successfully retrieved within the maximum retries.
|
|
206
247
|
|
|
248
|
+
Raises:
|
|
249
|
+
CapmonsterException:
|
|
250
|
+
If the maximum retry limit is exceeded without obtaining the task result.
|
|
251
|
+
"""
|
|
252
|
+
return (await self.join_task_result_detailed_async(task_id)).solution
|
|
253
|
+
|
|
254
|
+
async def join_task_result_detailed_async(self, task_id: int) -> TaskResult:
|
|
255
|
+
"""
|
|
256
|
+
Asynchronously polls the result of a task like `join_task_result_async`, but returns its status and cost too.
|
|
257
|
+
|
|
258
|
+
Args:
|
|
259
|
+
task_id: The identifier of the task for which the result needs to be retrieved.
|
|
260
|
+
|
|
261
|
+
Returns:
|
|
262
|
+
TaskResult: The status, solution and cost of the completed task.
|
|
263
|
+
|
|
207
264
|
Raises:
|
|
208
265
|
CapmonsterException:
|
|
209
266
|
If the maximum retry limit is exceeded without obtaining the task result.
|
|
210
267
|
"""
|
|
211
268
|
for _ in range(0, self.__max_retries + 1):
|
|
212
|
-
result = await self.
|
|
213
|
-
if result:
|
|
269
|
+
result = await self.get_task_result_detailed_async(task_id)
|
|
270
|
+
if result.solution:
|
|
214
271
|
return result
|
|
215
|
-
|
|
216
|
-
await asyncio.sleep(self.__retry_delay)
|
|
272
|
+
await asyncio.sleep(self.__retry_delay)
|
|
217
273
|
raise CapmonsterAPIException(
|
|
218
274
|
61, "ERROR_MAXIMUM_TIME_EXCEED", "Maximum time is exceed.")
|
|
219
275
|
|
|
@@ -230,8 +286,21 @@ class CapmonsterClient:
|
|
|
230
286
|
Returns:
|
|
231
287
|
dict: The solution dictionary from the completed task.
|
|
232
288
|
"""
|
|
289
|
+
return self.solve_detailed(task, callback_url).solution
|
|
290
|
+
|
|
291
|
+
def solve_detailed(self, task: TaskPayload, callback_url: Optional[str] = None) -> TaskResult:
|
|
292
|
+
"""
|
|
293
|
+
Creates a task and polls for its result like `solve`, but returns its status and cost too.
|
|
294
|
+
|
|
295
|
+
Args:
|
|
296
|
+
task: The task configuration payload.
|
|
297
|
+
callback_url: An optional callback URL for task completion.
|
|
298
|
+
|
|
299
|
+
Returns:
|
|
300
|
+
TaskResult: The status, solution and cost of the completed task.
|
|
301
|
+
"""
|
|
233
302
|
task_id = self.create_task(task, callback_url)
|
|
234
|
-
return self.
|
|
303
|
+
return self.join_task_result_detailed(task_id)
|
|
235
304
|
|
|
236
305
|
async def solve_async(self, task: TaskPayload, callback_url: Optional[str] = None) -> dict:
|
|
237
306
|
"""
|
|
@@ -246,8 +315,21 @@ class CapmonsterClient:
|
|
|
246
315
|
Returns:
|
|
247
316
|
dict: The solution dictionary from the completed task.
|
|
248
317
|
"""
|
|
318
|
+
return (await self.solve_detailed_async(task, callback_url)).solution
|
|
319
|
+
|
|
320
|
+
async def solve_detailed_async(self, task: TaskPayload, callback_url: Optional[str] = None) -> TaskResult:
|
|
321
|
+
"""
|
|
322
|
+
Async version of `solve_detailed`: creates a task and polls for its result, including its status and cost.
|
|
323
|
+
|
|
324
|
+
Args:
|
|
325
|
+
task: The task configuration payload.
|
|
326
|
+
callback_url: An optional callback URL for task completion.
|
|
327
|
+
|
|
328
|
+
Returns:
|
|
329
|
+
TaskResult: The status, solution and cost of the completed task.
|
|
330
|
+
"""
|
|
249
331
|
task_id = await self.create_task_async(task, callback_url)
|
|
250
|
-
return await self.
|
|
332
|
+
return await self.join_task_result_detailed_async(task_id)
|
|
251
333
|
|
|
252
334
|
def report_incorrect_image(self, task_id: int) -> None:
|
|
253
335
|
"""
|
|
@@ -35,3 +35,23 @@ class CreateTaskPayload(BaseModel):
|
|
|
35
35
|
@field_serializer("task")
|
|
36
36
|
def serialize_task(self, task: TaskPayload, _info) -> dict:
|
|
37
37
|
return task.to_request()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class TaskResult(BaseModel):
|
|
41
|
+
"""
|
|
42
|
+
Represents the full result of a task returned by getTaskResult.
|
|
43
|
+
|
|
44
|
+
Attributes:
|
|
45
|
+
status (str): "processing" while the task is being solved, "ready" when it is done.
|
|
46
|
+
solution (dict): The solution of the task; empty while the task is processing.
|
|
47
|
+
cost (Optional[float]): Cost of the task in USD; only returned when the task is ready.
|
|
48
|
+
"""
|
|
49
|
+
status: str = Field(default="processing", description="Task status: processing or ready.")
|
|
50
|
+
solution: dict = Field(default_factory=dict, description="Task solution.")
|
|
51
|
+
cost: Optional[float] = Field(default=None, description="Cost of the task in USD.")
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_response(cls, response: dict) -> "TaskResult":
|
|
55
|
+
return cls(status=response.get("status") or "processing",
|
|
56
|
+
solution=response.get("solution") or {},
|
|
57
|
+
cost=response.get("cost"))
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
+
from .alibaba import AlibabaTask, AlibabaMetadata
|
|
1
2
|
from .altcha import AltchaTask, AltchaMetadata
|
|
2
3
|
from .amazon import AmazonTask
|
|
4
|
+
from .arcaptcha import ARCaptchaTask
|
|
3
5
|
from .basilisk import BasiliskTask
|
|
4
6
|
from .binance import BinanceTask
|
|
5
7
|
from .castle import CastleTask, CastleMetadata
|
|
6
8
|
from .complex_image_recaptcha import ComplexImageRecaptchaTask, ComplexImageRecaptchaMetadata
|
|
7
9
|
from .complex_image_recognition import ComplexImageRecognitionTask
|
|
8
10
|
from .datadome import DataDomeTask, DataDomeMetadata
|
|
11
|
+
from .fengkongcloud import FengkongCloudTask, FengkongCloudMetadata
|
|
12
|
+
from .friendly import FriendlyTask, FriendlyMetadata
|
|
9
13
|
from .funcaptcha import FunCaptchaTask
|
|
10
14
|
from .geetest import GeeTestV4Task, GeeTestV3Task
|
|
11
|
-
from .
|
|
15
|
+
from .heytap import HeyTapTask, HeyTapMetadata
|
|
16
|
+
from .hunt import HuntTask, HuntMetadata
|
|
12
17
|
from .image_to_text import ImageToTextTask
|
|
13
18
|
from .imperva import ImpervaTask, ImpervaTaskMetadata
|
|
14
19
|
from .mtcaptcha import MTCaptchaTask
|
|
15
20
|
from .prosopo import ProsopoTask
|
|
21
|
+
from .proton import ProtonTask, ProtonMetadata
|
|
16
22
|
from .recaptcha_click import RecaptchaClickTask
|
|
17
23
|
from .recaptcha_v2 import RecaptchaV2Task
|
|
18
24
|
from .recaptcha_v2_enterprise import RecaptchaV2EnterpriseTask
|
|
@@ -20,7 +26,7 @@ from .recaptcha_v3 import RecaptchaV3Task
|
|
|
20
26
|
from .recaptcha_v3_enterprise import RecaptchaV3EnterpriseTask
|
|
21
27
|
from .task import VanillaTaskPayload, ProxyPayload, UserAgentPayload
|
|
22
28
|
from .temu import TemuTask
|
|
23
|
-
from .tendi import TenDITask
|
|
29
|
+
from .tendi import TenDITask, TenDIMetadata
|
|
24
30
|
from .tspd import TSPDTask, TSPDMetadata
|
|
25
31
|
from .turnstile import TurnstileTask, TurnstileCloudFlareTask, TurnstileWaitingRoomTask
|
|
26
32
|
from .yidun import YidunTask
|
|
@@ -29,9 +35,12 @@ __all__ = [
|
|
|
29
35
|
"VanillaTaskPayload",
|
|
30
36
|
"ProxyPayload",
|
|
31
37
|
"UserAgentPayload",
|
|
38
|
+
"AlibabaTask",
|
|
39
|
+
"AlibabaMetadata",
|
|
32
40
|
"AltchaTask",
|
|
33
41
|
"AltchaMetadata",
|
|
34
42
|
"AmazonTask",
|
|
43
|
+
"ARCaptchaTask",
|
|
35
44
|
"BasiliskTask",
|
|
36
45
|
"BinanceTask",
|
|
37
46
|
"CastleTask",
|
|
@@ -41,15 +50,24 @@ __all__ = [
|
|
|
41
50
|
"ComplexImageRecognitionTask",
|
|
42
51
|
"DataDomeTask",
|
|
43
52
|
"DataDomeMetadata",
|
|
53
|
+
"FengkongCloudTask",
|
|
54
|
+
"FengkongCloudMetadata",
|
|
55
|
+
"FriendlyTask",
|
|
56
|
+
"FriendlyMetadata",
|
|
44
57
|
"FunCaptchaTask",
|
|
45
58
|
"GeeTestV3Task",
|
|
46
59
|
"GeeTestV4Task",
|
|
60
|
+
"HeyTapTask",
|
|
61
|
+
"HeyTapMetadata",
|
|
47
62
|
"HuntTask",
|
|
63
|
+
"HuntMetadata",
|
|
48
64
|
"ImageToTextTask",
|
|
49
65
|
"ImpervaTask",
|
|
50
66
|
"ImpervaTaskMetadata",
|
|
51
67
|
"MTCaptchaTask",
|
|
52
68
|
"ProsopoTask",
|
|
69
|
+
"ProtonTask",
|
|
70
|
+
"ProtonMetadata",
|
|
53
71
|
"RecaptchaClickTask",
|
|
54
72
|
"RecaptchaV2Task",
|
|
55
73
|
"RecaptchaV2EnterpriseTask",
|
|
@@ -57,6 +75,7 @@ __all__ = [
|
|
|
57
75
|
"RecaptchaV3EnterpriseTask",
|
|
58
76
|
"TemuTask",
|
|
59
77
|
"TenDITask",
|
|
78
|
+
"TenDIMetadata",
|
|
60
79
|
"TSPDTask",
|
|
61
80
|
"TSPDMetadata",
|
|
62
81
|
"TurnstileTask",
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
from typing import Any, Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import Field, BaseModel, model_validator
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload, ProxyPayload, UserAgentPayload
|
|
6
|
+
from ..exceptions import CapmonsterValidationException
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AlibabaMetadata(BaseModel):
|
|
10
|
+
"""
|
|
11
|
+
Metadata for Alibaba task.
|
|
12
|
+
|
|
13
|
+
`sceneId` and `prefix` are required unless `punishUrl` is given. Pass the other
|
|
14
|
+
fields only if the website uses them.
|
|
15
|
+
|
|
16
|
+
Attributes:
|
|
17
|
+
sceneId: The captcha scenario identifier.
|
|
18
|
+
prefix: Captcha initialization parameter (the subdomain of the captcha-open URL).
|
|
19
|
+
userId: Unique identifier of the user or session on the website side.
|
|
20
|
+
userUserId: Additional (secondary) user identifier.
|
|
21
|
+
verifyType: Version or type of the verification mechanism, e.g. "1.0".
|
|
22
|
+
region: Region that processes the captcha, e.g. "cn" or "sgp".
|
|
23
|
+
UserCertifyId: Verification ID of the current captcha session.
|
|
24
|
+
apiGetLib: Link to the captcha JS library used by the website.
|
|
25
|
+
punishUrl: Full URL of the /punish verification page, including its query string.
|
|
26
|
+
cookieRequired: Return cookies with the solution (for Alibaba WAF).
|
|
27
|
+
"""
|
|
28
|
+
sceneId: Optional[str] = Field(default=None, description="The captcha scenario identifier.")
|
|
29
|
+
prefix: Optional[str] = Field(default=None, description="Captcha initialization parameter.")
|
|
30
|
+
userId: Optional[str] = Field(default=None, description="User or session identifier.")
|
|
31
|
+
userUserId: Optional[str] = Field(default=None, description="Secondary user identifier.")
|
|
32
|
+
verifyType: Optional[str] = Field(default=None, description="Verification mechanism version.")
|
|
33
|
+
region: Optional[str] = Field(default=None, description="Region that processes the captcha.")
|
|
34
|
+
UserCertifyId: Optional[str] = Field(default=None, description="Verification ID of the captcha session.")
|
|
35
|
+
apiGetLib: Optional[str] = Field(default=None, description="Link to the captcha JS library.")
|
|
36
|
+
punishUrl: Optional[str] = Field(default=None, description="Full URL of the /punish verification page.")
|
|
37
|
+
cookieRequired: Optional[bool] = Field(default=None, description="Return cookies with the solution.")
|
|
38
|
+
|
|
39
|
+
@model_validator(mode="after")
|
|
40
|
+
def check_required(self) -> "AlibabaMetadata":
|
|
41
|
+
if self.punishUrl is None and (self.sceneId is None or self.prefix is None):
|
|
42
|
+
raise CapmonsterValidationException("sceneId and prefix are required unless punishUrl is set",
|
|
43
|
+
task="AlibabaTask")
|
|
44
|
+
return self
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class AlibabaTask(TaskPayload, UserAgentPayload):
|
|
48
|
+
"""
|
|
49
|
+
Represents a task for solving Alibaba captcha challenges.
|
|
50
|
+
|
|
51
|
+
Uses CustomTask type with class "alibaba".
|
|
52
|
+
|
|
53
|
+
Attributes:
|
|
54
|
+
websiteURL: Full URL of the page with the captcha.
|
|
55
|
+
metadata: Alibaba-specific metadata.
|
|
56
|
+
proxy: Optional proxy settings.
|
|
57
|
+
"""
|
|
58
|
+
type: str = Field(default="CustomTask", frozen=True)
|
|
59
|
+
class_: str = Field(default="alibaba", alias="class", frozen=True)
|
|
60
|
+
websiteURL: str = Field(..., description='Full URL of the page with the captcha.')
|
|
61
|
+
metadata: AlibabaMetadata = Field(..., description='Alibaba-specific metadata.')
|
|
62
|
+
proxy: Optional[ProxyPayload] = Field(default=None, description='Proxy settings.')
|
|
63
|
+
|
|
64
|
+
def to_request(self) -> dict[str, Any]:
|
|
65
|
+
base = self.model_dump(exclude_none=True, by_alias=True)
|
|
66
|
+
proxy_dict = base.pop("proxy", {})
|
|
67
|
+
if proxy_dict:
|
|
68
|
+
base.update(proxy_dict)
|
|
69
|
+
return base
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from typing import Any, Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload, UserAgentPayload
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ARCaptchaTask(TaskPayload, UserAgentPayload):
|
|
9
|
+
"""
|
|
10
|
+
Represents a task for solving ARCaptcha challenges. This task does not use a proxy.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
websiteURL: Address of the main page where the captcha is located.
|
|
14
|
+
websiteKey: The siteKey value found on the page.
|
|
15
|
+
isInvisible: Set to True if the captcha is invisible.
|
|
16
|
+
"""
|
|
17
|
+
type: str = Field(default="ArCaptchaTask", frozen=True)
|
|
18
|
+
websiteURL: str = Field(..., description='Address of the main page where the captcha is located.')
|
|
19
|
+
websiteKey: str = Field(..., description='The siteKey value found on the page.')
|
|
20
|
+
isInvisible: Optional[bool] = Field(default=None, description='Set to true if the captcha is invisible.')
|
|
21
|
+
|
|
22
|
+
def to_request(self) -> dict[str, Any]:
|
|
23
|
+
return self.model_dump(exclude_none=True)
|