capmonster-python 4.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.1.0/PKG-INFO +247 -0
- capmonster_python-5.1.0/README.md +218 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/pyproject.toml +31 -3
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/__init__.py +29 -0
- capmonster_python-5.1.0/src/capmonster_python/_deprecation.py +24 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/client.py +232 -32
- capmonster_python-5.1.0/src/capmonster_python/methods.py +57 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/__init__.py +85 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/alibaba.py +69 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/altcha.py +48 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/amazon.py +54 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/arcaptcha.py +23 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/castle.py +53 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/complex_image_recognition.py +57 -0
- {capmonster_python-4.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.1.0/src/capmonster_python/tasks/funcaptcha.py +45 -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/mtcaptcha.py +36 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/proton.py +40 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/recaptcha_click.py +39 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/recaptcha_v2.py +4 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/recaptcha_v2_enterprise.py +7 -1
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/recaptcha_v3.py +4 -0
- capmonster_python-5.1.0/src/capmonster_python/tasks/recaptcha_v3_enterprise.py +30 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/temu.py +7 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/tendi.py +18 -2
- capmonster_python-5.1.0/src/capmonster_python/tasks/tspd.py +44 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/turnstile.py +34 -7
- capmonster_python-5.1.0/src/capmonster_python/tasks/yidun.py +49 -0
- capmonster_python-5.1.0/src/capmonster_python.egg-info/PKG-INFO +247 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python.egg-info/SOURCES.txt +18 -1
- capmonster_python-4.0.0/PKG-INFO +0 -150
- capmonster_python-4.0.0/README.md +0 -128
- capmonster_python-4.0.0/src/capmonster_python/methods.py +0 -32
- capmonster_python-4.0.0/src/capmonster_python/tasks/__init__.py +0 -42
- capmonster_python-4.0.0/src/capmonster_python/tasks/complex_image_recognition.py +0 -33
- capmonster_python-4.0.0/src/capmonster_python/tasks/imperva.py +0 -50
- capmonster_python-4.0.0/src/capmonster_python.egg-info/PKG-INFO +0 -150
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/LICENSE +0 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/setup.cfg +0 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/exceptions.py +0 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/basilisk.py +0 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/binance.py +0 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/complex_image_recaptcha.py +0 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/geetest.py +0 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/image_to_text.py +0 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/prosopo.py +0 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python/tasks/task.py +0 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python.egg-info/dependency_links.txt +0 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python.egg-info/requires.txt +0 -0
- {capmonster_python-4.0.0 → capmonster_python-5.1.0}/src/capmonster_python.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: capmonster_python
|
|
3
|
+
Version: 5.1.0
|
|
4
|
+
Summary: capmonster.cloud library/package for Python
|
|
5
|
+
Author-email: Alperen Sert <business@alperen.io>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Documentation, https://alperensert.github.io/capmonster_python/
|
|
8
|
+
Project-URL: Source, https://github.com/alperensert/capmonster_python/
|
|
9
|
+
Project-URL: Tracker, https://github.com/alperensert/capmonster_python/issues
|
|
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
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Framework :: AsyncIO
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
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
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: httpx>=0.27.0
|
|
27
|
+
Requires-Dist: pydantic>=2.0
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# Capmonster Python
|
|
31
|
+
|
|
32
|
+
[](https://pypi.org/project/capmonster-python/)
|
|
33
|
+
[](https://github.com/alperensert/capmonster_python/releases)
|
|
34
|
+
[](https://github.com/alperensert/capmonster_python/commits/master)
|
|
35
|
+
[&cacheSeconds=3600)](https://github.com/alperensert/capmonster_python)
|
|
36
|
+
|
|
37
|
+
A modern, strongly-typed Python SDK for [CapMonster Cloud](https://capmonster.cloud/) — solve reCAPTCHA, Turnstile, GeeTest, and 20+ other CAPTCHA types with both sync and async support.
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install capmonster_python
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
> [!IMPORTANT]
|
|
46
|
+
> This is **v4** of Capmonster Python, which includes breaking changes from v3.x.
|
|
47
|
+
> For the legacy API: `pip install capmonster_python==3.2`
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from capmonster_python import CapmonsterClient, RecaptchaV2Task
|
|
53
|
+
|
|
54
|
+
client = CapmonsterClient(api_key="YOUR_API_KEY")
|
|
55
|
+
|
|
56
|
+
task = RecaptchaV2Task(
|
|
57
|
+
websiteURL="https://example.com",
|
|
58
|
+
websiteKey="SITE_KEY_HERE"
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
result = client.solve(task)
|
|
62
|
+
print(result) # {"gRecaptchaResponse": "03AGdBq24..."}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Async
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
import asyncio
|
|
69
|
+
from capmonster_python import CapmonsterClient, RecaptchaV3Task
|
|
70
|
+
|
|
71
|
+
async def main():
|
|
72
|
+
async with CapmonsterClient(api_key="YOUR_API_KEY") as client:
|
|
73
|
+
task = RecaptchaV3Task(
|
|
74
|
+
websiteURL="https://example.com",
|
|
75
|
+
websiteKey="SITE_KEY_HERE",
|
|
76
|
+
minScore=0.5,
|
|
77
|
+
pageAction="verify"
|
|
78
|
+
)
|
|
79
|
+
result = await client.solve_async(task)
|
|
80
|
+
print(result)
|
|
81
|
+
|
|
82
|
+
asyncio.run(main())
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### With Proxy
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from capmonster_python import CapmonsterClient, RecaptchaV2Task, ProxyPayload
|
|
89
|
+
|
|
90
|
+
client = CapmonsterClient(api_key="YOUR_API_KEY")
|
|
91
|
+
|
|
92
|
+
task = RecaptchaV2Task(
|
|
93
|
+
websiteURL="https://example.com",
|
|
94
|
+
websiteKey="SITE_KEY_HERE",
|
|
95
|
+
proxy=ProxyPayload(
|
|
96
|
+
proxyType="http",
|
|
97
|
+
proxyAddress="1.2.3.4",
|
|
98
|
+
proxyPort=8080,
|
|
99
|
+
proxyLogin="user",
|
|
100
|
+
proxyPassword="pass"
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
result = client.solve(task)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Client API
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
CapmonsterClient(api_key, timeout=30.0, max_retries=120, retry_delay=2.0)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
| Method | Description |
|
|
114
|
+
|--------|-------------|
|
|
115
|
+
| `solve(task)` | Create task and poll until solved |
|
|
116
|
+
| `create_task(task)` | Create a task, returns `task_id` |
|
|
117
|
+
| `join_task_result(task_id)` | Poll until result is ready |
|
|
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 |
|
|
121
|
+
| `get_balance()` | Get account balance |
|
|
122
|
+
| `get_user_agent()` | Get current valid User-Agent string |
|
|
123
|
+
| `report_incorrect_image(task_id)` | Report bad image captcha solution |
|
|
124
|
+
| `report_incorrect_token(task_id)` | Report bad token captcha solution |
|
|
125
|
+
|
|
126
|
+
All methods have async variants with the `_async` suffix (e.g. `solve_async`, `get_balance_async`).
|
|
127
|
+
|
|
128
|
+
Both sync and async context managers are supported for proper connection cleanup.
|
|
129
|
+
|
|
130
|
+
## Supported CAPTCHA Types
|
|
131
|
+
|
|
132
|
+
### reCAPTCHA
|
|
133
|
+
|
|
134
|
+
| CAPTCHA Type | Class | Proxy |
|
|
135
|
+
|---|---|---|
|
|
136
|
+
| reCAPTCHA v2 | `RecaptchaV2Task` | Optional |
|
|
137
|
+
| reCAPTCHA v2 Enterprise | `RecaptchaV2EnterpriseTask` | Optional |
|
|
138
|
+
| reCAPTCHA v3 | `RecaptchaV3Task` | No |
|
|
139
|
+
| reCAPTCHA v3 Enterprise | `RecaptchaV3EnterpriseTask` | No |
|
|
140
|
+
| reCAPTCHA Click | `RecaptchaClickTask` (deprecated, use `ComplexImageRecaptchaTask`) | Optional |
|
|
141
|
+
|
|
142
|
+
### Cloudflare
|
|
143
|
+
|
|
144
|
+
| CAPTCHA Type | Class | Proxy |
|
|
145
|
+
|---|---|---|
|
|
146
|
+
| Turnstile | `TurnstileTask` | No |
|
|
147
|
+
| Turnstile Challenge (token / cf_clearance) | `TurnstileCloudFlareTask` | Optional / Required |
|
|
148
|
+
| Turnstile Waiting Room | `TurnstileWaitingRoomTask` | Required |
|
|
149
|
+
|
|
150
|
+
### Image-Based
|
|
151
|
+
|
|
152
|
+
| CAPTCHA Type | Class | Proxy |
|
|
153
|
+
|---|---|---|
|
|
154
|
+
| Image-to-Text OCR | `ImageToTextTask` | No |
|
|
155
|
+
| Complex Image (reCAPTCHA click/grid) | `ComplexImageRecaptchaTask` | No |
|
|
156
|
+
| Complex Image Recognition | `ComplexImageRecognitionTask` | No |
|
|
157
|
+
|
|
158
|
+
### Behavioral / Interactive
|
|
159
|
+
|
|
160
|
+
| CAPTCHA Type | Class | Proxy |
|
|
161
|
+
|---|---|---|
|
|
162
|
+
| GeeTest v3 | `GeeTestV3Task` | Optional |
|
|
163
|
+
| GeeTest v4 | `GeeTestV4Task` | Optional |
|
|
164
|
+
| FunCaptcha (Arkose Labs) | `FunCaptchaTask` | Required |
|
|
165
|
+
| Hunt | `HuntTask` | Required |
|
|
166
|
+
| Alibaba | `AlibabaTask` | Optional |
|
|
167
|
+
| Friendly Captcha | `FriendlyTask` | Optional |
|
|
168
|
+
| ARCaptcha | `ARCaptchaTask` | No |
|
|
169
|
+
|
|
170
|
+
### Enterprise Protection
|
|
171
|
+
|
|
172
|
+
| CAPTCHA Type | Class | Proxy |
|
|
173
|
+
|---|---|---|
|
|
174
|
+
| DataDome | `DataDomeTask` | Required |
|
|
175
|
+
| Imperva (Incapsula) | `ImpervaTask` | Required |
|
|
176
|
+
| Amazon WAF | `AmazonTask` | Optional |
|
|
177
|
+
| TSPD | `TSPDTask` | Optional |
|
|
178
|
+
|
|
179
|
+
### Platform-Specific
|
|
180
|
+
|
|
181
|
+
| CAPTCHA Type | Class | Proxy |
|
|
182
|
+
|---|---|---|
|
|
183
|
+
| Binance | `BinanceTask` | Required |
|
|
184
|
+
| Temu | `TemuTask` (deprecated) | No |
|
|
185
|
+
| TenDI | `TenDITask` | Optional |
|
|
186
|
+
| FengkongCloud | `FengkongCloudTask` | No |
|
|
187
|
+
| HeyTap | `HeyTapTask` | No |
|
|
188
|
+
| Proton | `ProtonTask` | Required |
|
|
189
|
+
|
|
190
|
+
### Other
|
|
191
|
+
|
|
192
|
+
| CAPTCHA Type | Class | Proxy |
|
|
193
|
+
|---|---|---|
|
|
194
|
+
| Altcha | `AltchaTask` | No |
|
|
195
|
+
| Basilisk | `BasiliskTask` | No |
|
|
196
|
+
| Castle | `CastleTask` (deprecated) | No |
|
|
197
|
+
| MTCaptcha | `MTCaptchaTask` | Optional |
|
|
198
|
+
| Prosopo | `ProsopoTask` | Optional |
|
|
199
|
+
| Yidun | `YidunTask` | Optional |
|
|
200
|
+
|
|
201
|
+
> Don't see your captcha type? Use `VanillaTaskPayload` to build custom task payloads without waiting for an SDK update.
|
|
202
|
+
|
|
203
|
+
## Advanced Usage
|
|
204
|
+
|
|
205
|
+
### Callback URLs
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
result = client.solve(task, callback_url="https://yoursite.com/callback")
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Report Incorrect Solutions
|
|
212
|
+
|
|
213
|
+
```python
|
|
214
|
+
task_id = client.create_task(task)
|
|
215
|
+
result = client.join_task_result(task_id)
|
|
216
|
+
|
|
217
|
+
# If the token was rejected by the target site:
|
|
218
|
+
client.report_incorrect_token(task_id)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Fresh Token Generation
|
|
222
|
+
|
|
223
|
+
Use `nocache=True` on reCAPTCHA tasks to prevent cached token reuse:
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
task = RecaptchaV2Task(
|
|
227
|
+
websiteURL="https://example.com",
|
|
228
|
+
websiteKey="SITE_KEY_HERE",
|
|
229
|
+
nocache=True
|
|
230
|
+
)
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Documentation
|
|
234
|
+
|
|
235
|
+
Full API reference available at [alperensert.github.io/capmonster_python](https://alperensert.github.io/capmonster_python/).
|
|
236
|
+
|
|
237
|
+
## Support
|
|
238
|
+
|
|
239
|
+
- Found a bug? [Open an issue](https://github.com/alperensert/capmonster_python/issues)
|
|
240
|
+
- Contact: business@alperen.io
|
|
241
|
+
|
|
242
|
+
> [!NOTE]
|
|
243
|
+
> Support is limited to questions and issues related to this project. Custom integrations and application-specific logic are outside the scope of support.
|
|
244
|
+
|
|
245
|
+
## License
|
|
246
|
+
|
|
247
|
+
[MIT License](/LICENSE)
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Capmonster Python
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/capmonster-python/)
|
|
4
|
+
[](https://github.com/alperensert/capmonster_python/releases)
|
|
5
|
+
[](https://github.com/alperensert/capmonster_python/commits/master)
|
|
6
|
+
[&cacheSeconds=3600)](https://github.com/alperensert/capmonster_python)
|
|
7
|
+
|
|
8
|
+
A modern, strongly-typed Python SDK for [CapMonster Cloud](https://capmonster.cloud/) — solve reCAPTCHA, Turnstile, GeeTest, and 20+ other CAPTCHA types with both sync and async support.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install capmonster_python
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
> [!IMPORTANT]
|
|
17
|
+
> This is **v4** of Capmonster Python, which includes breaking changes from v3.x.
|
|
18
|
+
> For the legacy API: `pip install capmonster_python==3.2`
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from capmonster_python import CapmonsterClient, RecaptchaV2Task
|
|
24
|
+
|
|
25
|
+
client = CapmonsterClient(api_key="YOUR_API_KEY")
|
|
26
|
+
|
|
27
|
+
task = RecaptchaV2Task(
|
|
28
|
+
websiteURL="https://example.com",
|
|
29
|
+
websiteKey="SITE_KEY_HERE"
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
result = client.solve(task)
|
|
33
|
+
print(result) # {"gRecaptchaResponse": "03AGdBq24..."}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Async
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
import asyncio
|
|
40
|
+
from capmonster_python import CapmonsterClient, RecaptchaV3Task
|
|
41
|
+
|
|
42
|
+
async def main():
|
|
43
|
+
async with CapmonsterClient(api_key="YOUR_API_KEY") as client:
|
|
44
|
+
task = RecaptchaV3Task(
|
|
45
|
+
websiteURL="https://example.com",
|
|
46
|
+
websiteKey="SITE_KEY_HERE",
|
|
47
|
+
minScore=0.5,
|
|
48
|
+
pageAction="verify"
|
|
49
|
+
)
|
|
50
|
+
result = await client.solve_async(task)
|
|
51
|
+
print(result)
|
|
52
|
+
|
|
53
|
+
asyncio.run(main())
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### With Proxy
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from capmonster_python import CapmonsterClient, RecaptchaV2Task, ProxyPayload
|
|
60
|
+
|
|
61
|
+
client = CapmonsterClient(api_key="YOUR_API_KEY")
|
|
62
|
+
|
|
63
|
+
task = RecaptchaV2Task(
|
|
64
|
+
websiteURL="https://example.com",
|
|
65
|
+
websiteKey="SITE_KEY_HERE",
|
|
66
|
+
proxy=ProxyPayload(
|
|
67
|
+
proxyType="http",
|
|
68
|
+
proxyAddress="1.2.3.4",
|
|
69
|
+
proxyPort=8080,
|
|
70
|
+
proxyLogin="user",
|
|
71
|
+
proxyPassword="pass"
|
|
72
|
+
)
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
result = client.solve(task)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Client API
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
CapmonsterClient(api_key, timeout=30.0, max_retries=120, retry_delay=2.0)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
| Method | Description |
|
|
85
|
+
|--------|-------------|
|
|
86
|
+
| `solve(task)` | Create task and poll until solved |
|
|
87
|
+
| `create_task(task)` | Create a task, returns `task_id` |
|
|
88
|
+
| `join_task_result(task_id)` | Poll until result is ready |
|
|
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 |
|
|
92
|
+
| `get_balance()` | Get account balance |
|
|
93
|
+
| `get_user_agent()` | Get current valid User-Agent string |
|
|
94
|
+
| `report_incorrect_image(task_id)` | Report bad image captcha solution |
|
|
95
|
+
| `report_incorrect_token(task_id)` | Report bad token captcha solution |
|
|
96
|
+
|
|
97
|
+
All methods have async variants with the `_async` suffix (e.g. `solve_async`, `get_balance_async`).
|
|
98
|
+
|
|
99
|
+
Both sync and async context managers are supported for proper connection cleanup.
|
|
100
|
+
|
|
101
|
+
## Supported CAPTCHA Types
|
|
102
|
+
|
|
103
|
+
### reCAPTCHA
|
|
104
|
+
|
|
105
|
+
| CAPTCHA Type | Class | Proxy |
|
|
106
|
+
|---|---|---|
|
|
107
|
+
| reCAPTCHA v2 | `RecaptchaV2Task` | Optional |
|
|
108
|
+
| reCAPTCHA v2 Enterprise | `RecaptchaV2EnterpriseTask` | Optional |
|
|
109
|
+
| reCAPTCHA v3 | `RecaptchaV3Task` | No |
|
|
110
|
+
| reCAPTCHA v3 Enterprise | `RecaptchaV3EnterpriseTask` | No |
|
|
111
|
+
| reCAPTCHA Click | `RecaptchaClickTask` (deprecated, use `ComplexImageRecaptchaTask`) | Optional |
|
|
112
|
+
|
|
113
|
+
### Cloudflare
|
|
114
|
+
|
|
115
|
+
| CAPTCHA Type | Class | Proxy |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| Turnstile | `TurnstileTask` | No |
|
|
118
|
+
| Turnstile Challenge (token / cf_clearance) | `TurnstileCloudFlareTask` | Optional / Required |
|
|
119
|
+
| Turnstile Waiting Room | `TurnstileWaitingRoomTask` | Required |
|
|
120
|
+
|
|
121
|
+
### Image-Based
|
|
122
|
+
|
|
123
|
+
| CAPTCHA Type | Class | Proxy |
|
|
124
|
+
|---|---|---|
|
|
125
|
+
| Image-to-Text OCR | `ImageToTextTask` | No |
|
|
126
|
+
| Complex Image (reCAPTCHA click/grid) | `ComplexImageRecaptchaTask` | No |
|
|
127
|
+
| Complex Image Recognition | `ComplexImageRecognitionTask` | No |
|
|
128
|
+
|
|
129
|
+
### Behavioral / Interactive
|
|
130
|
+
|
|
131
|
+
| CAPTCHA Type | Class | Proxy |
|
|
132
|
+
|---|---|---|
|
|
133
|
+
| GeeTest v3 | `GeeTestV3Task` | Optional |
|
|
134
|
+
| GeeTest v4 | `GeeTestV4Task` | Optional |
|
|
135
|
+
| FunCaptcha (Arkose Labs) | `FunCaptchaTask` | Required |
|
|
136
|
+
| Hunt | `HuntTask` | Required |
|
|
137
|
+
| Alibaba | `AlibabaTask` | Optional |
|
|
138
|
+
| Friendly Captcha | `FriendlyTask` | Optional |
|
|
139
|
+
| ARCaptcha | `ARCaptchaTask` | No |
|
|
140
|
+
|
|
141
|
+
### Enterprise Protection
|
|
142
|
+
|
|
143
|
+
| CAPTCHA Type | Class | Proxy |
|
|
144
|
+
|---|---|---|
|
|
145
|
+
| DataDome | `DataDomeTask` | Required |
|
|
146
|
+
| Imperva (Incapsula) | `ImpervaTask` | Required |
|
|
147
|
+
| Amazon WAF | `AmazonTask` | Optional |
|
|
148
|
+
| TSPD | `TSPDTask` | Optional |
|
|
149
|
+
|
|
150
|
+
### Platform-Specific
|
|
151
|
+
|
|
152
|
+
| CAPTCHA Type | Class | Proxy |
|
|
153
|
+
|---|---|---|
|
|
154
|
+
| Binance | `BinanceTask` | Required |
|
|
155
|
+
| Temu | `TemuTask` (deprecated) | No |
|
|
156
|
+
| TenDI | `TenDITask` | Optional |
|
|
157
|
+
| FengkongCloud | `FengkongCloudTask` | No |
|
|
158
|
+
| HeyTap | `HeyTapTask` | No |
|
|
159
|
+
| Proton | `ProtonTask` | Required |
|
|
160
|
+
|
|
161
|
+
### Other
|
|
162
|
+
|
|
163
|
+
| CAPTCHA Type | Class | Proxy |
|
|
164
|
+
|---|---|---|
|
|
165
|
+
| Altcha | `AltchaTask` | No |
|
|
166
|
+
| Basilisk | `BasiliskTask` | No |
|
|
167
|
+
| Castle | `CastleTask` (deprecated) | No |
|
|
168
|
+
| MTCaptcha | `MTCaptchaTask` | Optional |
|
|
169
|
+
| Prosopo | `ProsopoTask` | Optional |
|
|
170
|
+
| Yidun | `YidunTask` | Optional |
|
|
171
|
+
|
|
172
|
+
> Don't see your captcha type? Use `VanillaTaskPayload` to build custom task payloads without waiting for an SDK update.
|
|
173
|
+
|
|
174
|
+
## Advanced Usage
|
|
175
|
+
|
|
176
|
+
### Callback URLs
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
result = client.solve(task, callback_url="https://yoursite.com/callback")
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Report Incorrect Solutions
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
task_id = client.create_task(task)
|
|
186
|
+
result = client.join_task_result(task_id)
|
|
187
|
+
|
|
188
|
+
# If the token was rejected by the target site:
|
|
189
|
+
client.report_incorrect_token(task_id)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Fresh Token Generation
|
|
193
|
+
|
|
194
|
+
Use `nocache=True` on reCAPTCHA tasks to prevent cached token reuse:
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
task = RecaptchaV2Task(
|
|
198
|
+
websiteURL="https://example.com",
|
|
199
|
+
websiteKey="SITE_KEY_HERE",
|
|
200
|
+
nocache=True
|
|
201
|
+
)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Documentation
|
|
205
|
+
|
|
206
|
+
Full API reference available at [alperensert.github.io/capmonster_python](https://alperensert.github.io/capmonster_python/).
|
|
207
|
+
|
|
208
|
+
## Support
|
|
209
|
+
|
|
210
|
+
- Found a bug? [Open an issue](https://github.com/alperensert/capmonster_python/issues)
|
|
211
|
+
- Contact: business@alperen.io
|
|
212
|
+
|
|
213
|
+
> [!NOTE]
|
|
214
|
+
> Support is limited to questions and issues related to this project. Custom integrations and application-specific logic are outside the scope of support.
|
|
215
|
+
|
|
216
|
+
## License
|
|
217
|
+
|
|
218
|
+
[MIT License](/LICENSE)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "capmonster_python"
|
|
3
|
-
version = "
|
|
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,32 +1,61 @@
|
|
|
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",
|
|
14
|
+
"AltchaTask",
|
|
15
|
+
"AltchaMetadata",
|
|
16
|
+
"AmazonTask",
|
|
17
|
+
"ARCaptchaTask",
|
|
10
18
|
"BasiliskTask",
|
|
11
19
|
"BinanceTask",
|
|
20
|
+
"CastleTask",
|
|
21
|
+
"CastleMetadata",
|
|
12
22
|
"ComplexImageRecaptchaTask",
|
|
13
23
|
"ComplexImageRecaptchaMetadata",
|
|
14
24
|
"ComplexImageRecognitionTask",
|
|
15
25
|
"DataDomeTask",
|
|
16
26
|
"DataDomeMetadata",
|
|
27
|
+
"FengkongCloudTask",
|
|
28
|
+
"FengkongCloudMetadata",
|
|
29
|
+
"FriendlyTask",
|
|
30
|
+
"FriendlyMetadata",
|
|
31
|
+
"FunCaptchaTask",
|
|
17
32
|
"GeeTestV3Task",
|
|
18
33
|
"GeeTestV4Task",
|
|
34
|
+
"HeyTapTask",
|
|
35
|
+
"HeyTapMetadata",
|
|
36
|
+
"HuntTask",
|
|
37
|
+
"HuntMetadata",
|
|
19
38
|
"ImageToTextTask",
|
|
20
39
|
"ImpervaTask",
|
|
21
40
|
"ImpervaTaskMetadata",
|
|
41
|
+
"MTCaptchaTask",
|
|
22
42
|
"ProsopoTask",
|
|
43
|
+
"ProtonTask",
|
|
44
|
+
"ProtonMetadata",
|
|
45
|
+
"RecaptchaClickTask",
|
|
23
46
|
"RecaptchaV2Task",
|
|
24
47
|
"RecaptchaV2EnterpriseTask",
|
|
25
48
|
"RecaptchaV3Task",
|
|
49
|
+
"RecaptchaV3EnterpriseTask",
|
|
26
50
|
"TemuTask",
|
|
27
51
|
"TenDITask",
|
|
52
|
+
"TenDIMetadata",
|
|
53
|
+
"TSPDTask",
|
|
54
|
+
"TSPDMetadata",
|
|
28
55
|
"TurnstileTask",
|
|
29
56
|
"TurnstileCloudFlareTask",
|
|
57
|
+
"TurnstileWaitingRoomTask",
|
|
58
|
+
"YidunTask",
|
|
30
59
|
"CapmonsterException",
|
|
31
60
|
"CapmonsterAPIException",
|
|
32
61
|
"CapmonsterValidationException"
|
|
@@ -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)
|