|
1 | | -Capmonster.cloud for Python |
2 | | -= |
3 | | -       |
| 1 | +# 🤖 Capmonster Python |
4 | 2 |
|
5 | | -[Capmonster.cloud](https://capmonster.cloud) package for Python3 |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +&cacheSeconds=3600) |
6 | 8 |
|
7 | | -If you have any problem with usage, [read the documentation](https://alperensert.github.io/capmonster_python) |
8 | | -or [create an issue](https://github.com/alperensert/capmonster_python/issues/new) |
| 9 | +A modern, strongly typed, async-friendly Python SDK for solving CAPTCHA challenges |
| 10 | +using [Capmonster.Cloud](https://capmonster.cloud/). |
9 | 11 |
|
10 | | -*At least 2x cheaper, up to 30x faster than manual recognition services.* |
| 12 | +Supports reCAPTCHA v2 & v3, Cloudflare Turnstile, GeeTest (v3 & v4) and [much more](#-supported-captcha-types). |
11 | 13 |
|
12 | | -### Installation |
| 14 | +--- |
13 | 15 |
|
14 | | -``` |
| 16 | +## ✨ Features |
| 17 | + |
| 18 | +- ✅ Fully typed Pydantic v2 models |
| 19 | +- 🔁 Both sync and async API support |
| 20 | +- 🔐 Proxy and User-Agent configuration |
| 21 | +- 📦 Supports the most common CAPTCHA types |
| 22 | +- 📚 Intuitive API with powerful task building |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## 🔧 Installation |
| 27 | + |
| 28 | +```bash |
15 | 29 | pip install capmonster_python |
16 | 30 | ``` |
17 | 31 |
|
18 | | -### Supported captcha types |
19 | | - |
20 | | -- Image to text |
21 | | -- Recaptcha v2 |
22 | | -- Recaptcha v2 Enterprise |
23 | | -- Recaptcha v3 |
24 | | -- Fun Captcha |
25 | | -- HCaptcha |
26 | | -- GeeTest |
27 | | -- Turnstile Task |
28 | | -- Data Dome |
| 32 | +> [!IMPORTANT] |
| 33 | +> You're viewing the documentation for **Capmonster Python v4**, which includes breaking changes. If you prefer the |
| 34 | +> old syntax used in versions prior to 4.x, you can continue using it by installing the legacy version: |
| 35 | +> ```pip install capmonster_python==3.2``` |
29 | 36 |
|
30 | | -Usage examples |
31 | | -- |
| 37 | +## 🚀 Quick Start |
32 | 38 |
|
33 | | -#### ImageToText |
| 39 | +### Async Example |
34 | 40 |
|
35 | 41 | ```python |
36 | | -from src.capmonster_python import ImageToTextTask |
| 42 | +import asyncio |
| 43 | +from capmonster_python import CapmonsterClient, RecaptchaV3Task |
37 | 44 |
|
38 | | -capmonster = ImageToTextTask("API_KEY") |
39 | | -task_id = capmonster.create_task(image_path="img.png") |
40 | | -result = capmonster.join_task_result(task_id) |
41 | | -print(result.get("text")) |
42 | | -``` |
43 | 45 |
|
44 | | -#### Recaptcha v2 |
| 46 | +async def main(): |
| 47 | + client = CapmonsterClient(api_key="YOUR_API_KEY") |
45 | 48 |
|
46 | | -```python |
47 | | -from src.capmonster_python import RecaptchaV2Task |
| 49 | + task = RecaptchaV3Task( |
| 50 | + websiteURL="https://example.com", |
| 51 | + websiteKey="SITE_KEY_HERE", |
| 52 | + minScore=0.5, |
| 53 | + pageAction="verify" |
| 54 | + ) |
48 | 55 |
|
49 | | -capmonster = RecaptchaV2Task("API_KEY") |
50 | | -task_id = capmonster.create_task("website_url", "website_key") |
51 | | -result = capmonster.join_task_result(task_id) |
52 | | -print(result.get("gRecaptchaResponse")) |
53 | | -``` |
| 56 | + task_id = await client.create_task_async(task) |
| 57 | + result = await client.join_task_result_async(task_id) |
| 58 | + print(result) |
54 | 59 |
|
55 | | -#### Recaptcha v2 enterprise |
56 | 60 |
|
57 | | -```python |
58 | | -from src.capmonster_python import RecaptchaV2EnterpriseTask |
| 61 | +asyncio.run(main()) |
59 | 62 |
|
60 | | -capmonster = RecaptchaV2EnterpriseTask("API_KEY") |
61 | | -task_id = capmonster.create_task("website_url", "website_key", {"s": "payload value"}, "api_domain") |
62 | | -result = capmonster.join_task_result(task_id) |
63 | | -print(result.get("gRecaptchaResponse")) |
64 | 63 | ``` |
65 | 64 |
|
66 | | -#### GeeTest |
| 65 | +### Sync Example |
67 | 66 |
|
68 | 67 | ```python |
69 | | -from src.capmonster_python import GeeTestTask |
70 | | - |
71 | | -capmonster = GeeTestTask("API_KEY") |
72 | | -task_id = capmonster.create_task("website_url", "gt", "challenge") |
73 | | -result = capmonster.join_task_result(task_id) |
74 | | -print(result.get("challenge")) |
75 | | -print(result.get("seccode")) |
76 | | -print(result.get("validate")) |
77 | | -``` |
| 68 | +from capmonster_python import CapmonsterClient, RecaptchaV2Task |
78 | 69 |
|
79 | | -#### Report incorrect captchas |
| 70 | +client = CapmonsterClient(api_key="<YOUR_API_KEY>") |
80 | 71 |
|
81 | | -```python |
82 | | -from src.capmonster_python import RecaptchaV2Task |
| 72 | +task = RecaptchaV2Task( |
| 73 | + websiteURL="https://example.com", |
| 74 | + websiteKey="SITE_KEY_HERE" |
| 75 | +) |
83 | 76 |
|
84 | | -capmonster = RecaptchaV2Task("API_KEY") |
85 | | -task_id = capmonster.create_task("website_url", "website_key") |
86 | | -result = capmonster.join_task_result(task_id) |
87 | | -report_result = capmonster.report_incorrect_captcha("token", task_id) |
88 | | -print(report_result) |
| 77 | +task_id = client.create_task(task) |
| 78 | +result = client.join_task_result(task_id) |
| 79 | +print(result) |
89 | 80 | ``` |
90 | 81 |
|
91 | | -For other examples and api documentation please visit [wiki](https://alperensert.github.io/capmonster_python) |
| 82 | +--- |
| 83 | + |
| 84 | +## 🧠 Supported CAPTCHA Types |
| 85 | + |
| 86 | +Capmonster Python v4 supports a wide range of CAPTCHA formats — from mainstream challenges like reCAPTCHA and Turnstile |
| 87 | +to enterprise-grade shields like Imperva and DataDome. Each task supports full Pydantic validation ✅ and both sync and |
| 88 | +async clients 🔄 unless noted. |
| 89 | + |
| 90 | +| 🔖 Category | CAPTCHA Type | Class Name | Proxy Required | Notes | |
| 91 | +|---------------------------|--------------------------------|-------------------------------|----------------|----------------------------------------| |
| 92 | +| 🧩 reCAPTCHA | reCAPTCHA v2 | `RecaptchaV2Task` | Optional | Visible / Invisible supported ✅ 🔄 | |
| 93 | +| | reCAPTCHA v2 Enterprise | `RecaptchaV2EnterpriseTask` | Optional | `enterprisePayload` & `apiDomain` ✅ 🔄 | |
| 94 | +| | reCAPTCHA v3 | `RecaptchaV3Task` | ❌ No | Score-based, proxyless ✅ 🔄 | |
| 95 | +| 🛡️ Cloudflare | Turnstile (token) | `TurnstileTask` | ❌ No | Lightweight, async-ready ✅ 🔄 | |
| 96 | +| | Turnstile (cf_clearance) | `TurnstileCloudFlareTask` | ✅ Yes | Full HTML + proxy required ✅ 🔄 | |
| 97 | +| 📸 Image-based | Image-to-Text OCR | `ImageToTextTask` | ❌ No | Base64 image + module control ✅ 🔄 | |
| 98 | +| | Complex Image (Recaptcha-like) | `ComplexImageRecaptchaTask` | ❌ No | Grid-based, metadata aware ✅ 🔄 | |
| 99 | +| | Complex Image Recognition (AI) | `ComplexImageRecognitionTask` | ❌ No | Supports tasks like Shein, OOCL ✅ 🔄 | |
| 100 | +| 🧠 Human Behavior | GeeTest v3 | `GeeTestV3Task` | Optional | Challenge + `gt` key + freshness ✅ 🔄 | |
| 101 | +| | GeeTest v4 | `GeeTestV4Task` | Optional | `initParameters` supported ✅ 🔄 | |
| 102 | +| 🛡️ Enterprise Protection | DataDome | `DataDomeTask` | ✅ Recommended | Cookie & page context needed ✅ 🔄 | |
| 103 | +| | Imperva | `ImpervaTask` | ✅ Recommended | Incapsula + Reese84 logic ✅ 🔄 | |
| 104 | +| 🏦 Platform-Specific | Binance Login | `BinanceTask` | ✅ Yes | `validateId` for login flow ✅ 🔄 | |
| 105 | +| | Temu | `TemuTask` | ❌ No | Cookie-injected behavioral solver ✅ 🔄 | |
| 106 | +| | TenDI | `TenDITask` | ✅ Yes | Custom captchaAppId field ✅ 🔄 | |
| 107 | +| 🧪 Miscellaneous | Prosopo | `ProsopoTask` | Optional | Used in zk or crypto UIs ✅ 🔄 | |
| 108 | +| | Basilisk | `BasiliskTask` | ❌ No | Minimalist site-key puzzle ✅ 🔄 | |
| 109 | + |
| 110 | +## 🧩 Advanced Usage |
| 111 | + |
| 112 | +- Callback URLs are supported during task creation. |
| 113 | +- Includes auto-retry loop for polling results (up to 120s) |
| 114 | + |
| 115 | +## 💬 Community & Support |
| 116 | + |
| 117 | +Need help or have a question? |
| 118 | + |
| 119 | +- 📧 Contact: business@alperen.io |
| 120 | +- 🐛 Found a bug? [Open an issue](https://github.com/alperensert/capmonster_python/issues) |
| 121 | + |
| 122 | +> [!NOTE] |
| 123 | +> Community support is intended only for questions and issues related to this project. Custom usage scenarios, |
| 124 | +> integrations, or application-specific logic are outside the scope of support. |
| 125 | +
|
| 126 | +## 📄 License |
| 127 | + |
| 128 | +This project is licensed under the [MIT License](/LICENSE). |
0 commit comments