capmonstercloudclient 4.2.0__tar.gz → 4.3.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.
Files changed (62) hide show
  1. capmonstercloudclient-4.3.0/PKG-INFO +252 -0
  2. capmonstercloudclient-4.3.0/README.md +177 -0
  3. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/AlibabaCustomTaskRequest.py +21 -15
  4. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/FuncaptchaRequest.py +14 -8
  5. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/HuntCustomTaskRequest.py +10 -5
  6. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/RecaptchaComplexImageTask.py +9 -8
  7. capmonstercloudclient-4.3.0/capmonstercloud_client/version.txt +1 -0
  8. capmonstercloudclient-4.3.0/capmonstercloudclient.egg-info/PKG-INFO +252 -0
  9. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/setup.py +1 -1
  10. capmonstercloudclient-4.2.0/PKG-INFO +0 -177
  11. capmonstercloudclient-4.2.0/README.md +0 -93
  12. capmonstercloudclient-4.2.0/capmonstercloud_client/version.txt +0 -1
  13. capmonstercloudclient-4.2.0/capmonstercloudclient.egg-info/PKG-INFO +0 -177
  14. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/LICENSE +0 -0
  15. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/MANIFEST.in +0 -0
  16. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/CapMonsterCloudClient.py +0 -0
  17. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/GetResultTimeouts.py +0 -0
  18. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/__init__.py +0 -0
  19. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/captchaResult.py +0 -0
  20. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/clientOptions.py +0 -0
  21. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/exceptions.py +0 -0
  22. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requestController.py +0 -0
  23. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/AltchaCustomTaskRequest.py +0 -0
  24. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/AmazonWafRequest.py +0 -0
  25. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/BasiliskCustomTaskRequest.py +0 -0
  26. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/BinanceTaskRequest.py +0 -0
  27. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/CastleCustomTaskRequest.py +0 -0
  28. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/ComplexImageTaskBase.py +0 -0
  29. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/CustomTaskRequestBase.py +0 -0
  30. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/DataDomeCustomTaskRequest.py +0 -0
  31. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/FriendlyCustomTaskRequest.py +0 -0
  32. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/FuncaptchaComplexImageTask.py +0 -0
  33. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/GeetestRequest.py +0 -0
  34. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/HcaptchaComplexImageTask.py +0 -0
  35. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/HcaptchaRequest.py +0 -0
  36. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/ImageToTextRequest.py +0 -0
  37. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/ImpervaCustomTaskRequest.py +0 -0
  38. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/MTCaptchaRequest.py +0 -0
  39. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/ProsopoTaskRequest.py +0 -0
  40. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/RecaptchaV2EnterpiseRequest.py +0 -0
  41. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/RecaptchaV2Request.py +0 -0
  42. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/RecaptchaV3EnterpriseRequest.py +0 -0
  43. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/RecaptchaV3ProxylessRequest.py +0 -0
  44. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/RecognitionComplexImageTaskRequest.py +0 -0
  45. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/TemuCustomTaskRequest.py +0 -0
  46. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/TenDiCustomTaskRequest.py +0 -0
  47. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/TspdCustomTaskRequest.py +0 -0
  48. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/TurnstileRequest.py +0 -0
  49. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/YidunRequest.py +0 -0
  50. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/__init__.py +0 -0
  51. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/baseRequest.py +0 -0
  52. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/baseRequestWithProxy.py +0 -0
  53. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/enums.py +0 -0
  54. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/requests/proxy_info.py +0 -0
  55. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloud_client/utils.py +0 -0
  56. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloudclient.egg-info/SOURCES.txt +0 -0
  57. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloudclient.egg-info/dependency_links.txt +0 -0
  58. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloudclient.egg-info/requires.txt +0 -0
  59. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/capmonstercloudclient.egg-info/top_level.txt +0 -0
  60. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/pyproject.toml +0 -0
  61. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/requirements.txt +0 -0
  62. {capmonstercloudclient-4.2.0 → capmonstercloudclient-4.3.0}/setup.cfg +0 -0
@@ -0,0 +1,252 @@
1
+ Metadata-Version: 2.4
2
+ Name: capmonstercloudclient
3
+ Version: 4.3.0
4
+ Summary: Official CapMonsterCloud Client: https://capmonster.cloud/
5
+ Home-page: https://github.com/ZennoLab/capmonstercloud-client-python
6
+ Author: Andrey Ilyin
7
+ Author-email: andrey.ilyin@zennolab.com
8
+ License: AGPL-3.0
9
+ Keywords: captcha,recaptcha,geetest,hcaptcha,funcaptcha,python3,python-library,capmonster,capmonstercloud,capmonstercloudclient
10
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
11
+ Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.6
15
+ Classifier: Programming Language :: Python :: 3.7
16
+ Classifier: Programming Language :: Python :: 3.8
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: Programming Language :: Python :: 3.14
23
+ Classifier: Development Status :: 5 - Production/Stable
24
+ Classifier: Framework :: AsyncIO
25
+ Classifier: Operating System :: Unix
26
+ Classifier: Operating System :: Microsoft :: Windows
27
+ Classifier: Operating System :: MacOS
28
+ Requires-Python: >=3.6
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: aiohappyeyeballs==2.4.4; python_version >= "3.9" and python_version <= "3.13"
32
+ Requires-Dist: aiohttp==3.11.10; python_version >= "3.9" and python_version <= "3.13"
33
+ Requires-Dist: aiosignal==1.3.1; python_version >= "3.9" and python_version <= "3.13"
34
+ Requires-Dist: annotated-types==0.7.0; python_version >= "3.9" and python_version <= "3.13"
35
+ Requires-Dist: async-timeout==5.0.1; python_version >= "3.9" and python_version <= "3.11"
36
+ Requires-Dist: attrs==24.2.0; python_version >= "3.9" and python_version <= "3.13"
37
+ Requires-Dist: frozenlist==1.5.0; python_version >= "3.9" and python_version <= "3.13"
38
+ Requires-Dist: idna==3.10; python_version >= "3.9" and python_version <= "3.13"
39
+ Requires-Dist: multidict==6.1.0; python_version >= "3.9" and python_version <= "3.13"
40
+ Requires-Dist: propcache==0.2.1; python_version >= "3.9" and python_version <= "3.13"
41
+ Requires-Dist: pydantic-core==2.27.1; python_version >= "3.9" and python_version <= "3.13"
42
+ Requires-Dist: pydantic==2.10.3; python_version >= "3.9" and python_version <= "3.13"
43
+ Requires-Dist: typing-extensions==4.12.2; python_version >= "3.9" and python_version <= "3.13"
44
+ Requires-Dist: yarl==1.18.3; python_version >= "3.9" and python_version <= "3.13"
45
+ Requires-Dist: aiohttp==3.7.4; python_version >= "3.6" and python_version <= "3.8"
46
+ Requires-Dist: pydantic==2.10.3; python_version >= "3.8" and python_version < "3.9"
47
+ Requires-Dist: pydantic==2.5.3; python_version >= "3.7" and python_version < "3.8"
48
+ Requires-Dist: pydantic==2.1.*; python_version < "3.7"
49
+ Requires-Dist: aiohappyeyeballs==2.7.1; python_version == "3.14"
50
+ Requires-Dist: aiohttp==3.14.3; python_version == "3.14"
51
+ Requires-Dist: aiosignal==1.4.0; python_version == "3.14"
52
+ Requires-Dist: annotated-types==0.8.0; python_version == "3.14"
53
+ Requires-Dist: attrs==26.1.0; python_version == "3.14"
54
+ Requires-Dist: frozenlist==1.8.0; python_version == "3.14"
55
+ Requires-Dist: idna==3.18; python_version == "3.14"
56
+ Requires-Dist: multidict==6.7.1; python_version == "3.14"
57
+ Requires-Dist: propcache==0.5.2; python_version == "3.14"
58
+ Requires-Dist: pydantic-core==2.46.4; python_version == "3.14"
59
+ Requires-Dist: pydantic==2.13.4; python_version == "3.14"
60
+ Requires-Dist: typing-extensions==4.16.0; python_version == "3.14"
61
+ Requires-Dist: typing-inspection==0.4.2; python_version == "3.14"
62
+ Requires-Dist: yarl==1.24.5; python_version == "3.14"
63
+ Dynamic: author
64
+ Dynamic: author-email
65
+ Dynamic: classifier
66
+ Dynamic: description
67
+ Dynamic: description-content-type
68
+ Dynamic: home-page
69
+ Dynamic: keywords
70
+ Dynamic: license
71
+ Dynamic: license-file
72
+ Dynamic: requires-dist
73
+ Dynamic: requires-python
74
+ Dynamic: summary
75
+
76
+ # CapMonster Cloud Python SDK: AI Captcha Solver & Anti-Bot Bypass
77
+
78
+ <p align="center">
79
+ <a href="https://capmonster.cloud/en/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme">
80
+ <img src="https://img.shields.io/badge/CapMonster%20Cloud-Python%20Captcha%20Solver-00B2FF?style=for-the-badge&logo=python&logoColor=white" alt="CapMonster Cloud Python SDK" height="40">
81
+ </a>
82
+ </p>
83
+
84
+ <p align="center">
85
+ <strong>Fast, AI-driven CAPTCHA solving client for Python. Seamlessly bypass Cloudflare Turnstile, reCAPTCHA v2/v3/Enterprise, DataDome, GeeTest, and Amazon WAF in web scraping and browser automation.</strong>
86
+ </p>
87
+
88
+ <p align="center">
89
+ <a href="https://pypi.org/project/capmonstercloudclient/"><img src="https://img.shields.io/pypi/v/capmonstercloudclient.svg?style=flat-square&color=blue" alt="PyPI version"></a>
90
+ <a href="https://pepy.tech/project/capmonstercloudclient"><img src="https://static.pepy.tech/badge/capmonstercloudclient/month" alt="PyPI downloads"></a>
91
+ <a href="https://pypi.org/project/capmonstercloudclient/"><img src="https://img.shields.io/pypi/pyversions/capmonstercloudclient.svg?style=flat-square" alt="Python Versions"></a>
92
+ <a href="https://github.com/CapMonsterCloud/capmonster-python-captcha-solver/stargazers"><img src="https://img.shields.io/github/stars/CapMonsterCloud/capmonster-python-captcha-solver?style=flat-square&color=yellow" alt="GitHub Stars"></a>
93
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square" alt="License: MIT"></a>
94
+ </p>
95
+
96
+ ---
97
+
98
+ Official asynchronous Python SDK for [CapMonster Cloud](https://capmonster.cloud/en/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme). Easily plug ultra-fast AI captcha recognition into **Playwright, Selenium, Puppeteer, Scrapy, BeautifulSoup, and Requests** automation workflows without human-in-the-loop delays.
99
+
100
+ **[👉 Get your Free API Key & Free Trial Balance on CapMonster Cloud](https://dash.capmonster.cloud/Account/SignUp?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme)**
101
+
102
+ ---
103
+
104
+ ## ⚡ Highlights & Benchmarks
105
+
106
+ - ⚡ **Sub-Second Speed:** Automated AI models solve captchas in 300 ms to 6 seconds depending on the system load.
107
+ - 🤖 **Zero Human Workers:** 100% automated machine learning pipeline with no manual latencies.
108
+ - 🌐 **Browser Automation Ready:** Works out-of-the-box with **Playwright, Selenium, and Puppeteer**.
109
+ - 🛡️ **Modern Anti-Bot Bypass:** Full support for Cloudflare Turnstile, reCAPTCHA Enterprise, GeeTest, and Amazon WAF.
110
+ - 💰 **Cost-Effective:** Low-cost pricing structure based on pay-as-you-go balance.
111
+
112
+ ---
113
+
114
+ ## 📦 Installation
115
+
116
+ ```bash
117
+ pip install capmonstercloudclient
118
+ ```
119
+
120
+ ---
121
+
122
+ ## 🚀 Quick Start & Usage Examples
123
+
124
+ ### 1. Asynchronous reCAPTCHA v2 Solving
125
+
126
+ ```python
127
+ import asyncio
128
+ from capmonstercloudclient import CapMonsterClient, ClientOptions
129
+ from capmonstercloudclient.requests import RecaptchaV2Request
130
+
131
+ # Initialize client with your API key from dashboard
132
+ options = ClientOptions(api_key="YOUR_CAPMONSTER_API_KEY")
133
+ client = CapMonsterClient(options=options)
134
+
135
+ async def main():
136
+ # Build the task payload
137
+ request = RecaptchaV2Request(
138
+ websiteUrl="https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=high",
139
+ websiteKey="6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd"
140
+ )
141
+
142
+ # Send task and receive token
143
+ result = await client.solve_captcha(request)
144
+ print("reCAPTCHA Token:", result.get("gRecaptchaResponse"))
145
+
146
+ if __name__ == "__main__":
147
+ asyncio.run(main())
148
+ ```
149
+
150
+ ### 2. Browser Automation (Playwright + Cloudflare Turnstile)
151
+
152
+ ```python
153
+ import asyncio
154
+ from playwright.async_api import async_playwright
155
+ from capmonstercloudclient import CapMonsterClient, ClientOptions
156
+ from capmonstercloudclient.requests import TurnstileRequest
157
+
158
+ options = ClientOptions(api_key="YOUR_CAPMONSTER_API_KEY")
159
+ client = CapMonsterClient(options=options)
160
+
161
+ async def run_scraper():
162
+ # Solve Turnstile challenge via CapMonster Cloud
163
+ turnstile_req = TurnstileRequest(
164
+ websiteURL="https://target-website.com/login",
165
+ websiteKey="0x4AAAAAAABnPIDnK2k_e-2"
166
+ )
167
+ solution = await client.solve_captcha(turnstile_req)
168
+ token = solution.get("token")
169
+
170
+ # Inject token into Playwright browser session
171
+ async with async_playwright() as p:
172
+ browser = await p.chromium.launch(headless=False)
173
+ page = await browser.new_page()
174
+ await page.goto("https://target-website.com/login")
175
+
176
+ await page.evaluate(f'document.querySelector("[name=cf-turnstile-response]").value = "{token}";')
177
+ await page.click("#submit-button")
178
+ await browser.close()
179
+
180
+ if __name__ == "__main__":
181
+ asyncio.run(run_scraper())
182
+ ```
183
+
184
+ ---
185
+
186
+ ## 🛡️ Supported CAPTCHA Types
187
+
188
+ All task types conform to the official [CapMonster Cloud API Documentation](https://docs.capmonster.cloud/docs/captchas/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme):
189
+
190
+ | Protection Type | Task Request Class | Proxyless Mode |
191
+ | :--- | :--- | :---: |
192
+ | **Cloudflare Turnstile** | `TurnstileRequest` | ✅ Supported |
193
+ | **reCAPTCHA v2** | `RecaptchaV2Request` | ✅ Supported |
194
+ | **reCAPTCHA v3** | `RecaptchaV3ProxylessRequest` | ✅ Supported |
195
+ | **reCAPTCHA Enterprise** | `RecaptchaV2EnterpriseProxylessRequest` / `RecaptchaV2EnterpriseRequest` | ✅ Supported |
196
+ | **GeeTest (v3, v4)** | `GeeTestProxylessRequest` / `GeeTestRequest` | ✅ Supported |
197
+ | **Amazon WAF** | `AmazonWafRequest` | ✅ Supported |
198
+ | **DataDome** | `DataDomeCustomTaskRequest` | 🌐 Proxy Required |
199
+ | **Imperva / Incapsula** | `ImpervaCustomTaskRequest` / `ImpervaCustomTaskProxylessRequest` | ✅ Supported |
200
+ | **Binance CAPTCHA** | `BinanceTaskRequest` / `BinanceTaskProxylessRequest` | ✅ Supported |
201
+ | **Standard Text CAPTCHA** | `ImageToTextRequest` | ✅ Supported |
202
+ | **Complex Image Tasks** | `RecaptchaComplexImageTaskRequest` | ✅ Supported |
203
+
204
+ ---
205
+
206
+ ## 🛠️ How It Works
207
+
208
+ ```text
209
+ [ Script / Scraper ]
210
+ │
211
+ ▼
212
+ [ Extract sitekey & website URL ]
213
+ │
214
+ ▼
215
+ [ CapMonsterClient API ] ──► POST createTask to https://api.capmonster.cloud
216
+ │
217
+ ▼
218
+ [ Neural Network Processing ] ──► Poll getTaskResult (300ms - 6s)
219
+ │
220
+ ▼
221
+ [ Receive Token & Autosubmit ] ──► Complete bypass
222
+ ```
223
+
224
+ ---
225
+
226
+ ## ⚙️ Best Practices
227
+
228
+ - **Token Expiration:** Most tokens (reCAPTCHA, Turnstile) remain valid for 120 seconds. Inject and submit the solution immediately after receiving the response.
229
+ - **Proxy Usage:** For custom tasks and strict protections, use the same proxy in your scraping session and the CapMonster task payload.
230
+ - **Balance Monitoring:** Ensure your account balance remains positive in the [Dashboard](https://dash.capmonster.cloud/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme).
231
+
232
+ ---
233
+
234
+ ## 📚 Official Documentation & Links
235
+
236
+ - 📖 [Getting Started Guide](https://docs.capmonster.cloud/docs/getting-start/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme)
237
+ - 🎯 [Supported Captchas Overview](https://docs.capmonster.cloud/docs/captchas/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme)
238
+ - ⚙️ [API Methods Reference](https://docs.capmonster.cloud/docs/methods/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme)
239
+ - 💬 [Support & Community](https://capmonster.cloud/en/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme#support)
240
+
241
+ ## Other official SDKs
242
+
243
+ - [.NET](https://github.com/CapMonsterCloud/capmonster-dotnet-captcha-solver)
244
+ - [Node.js](https://github.com/CapMonsterCloud/capmonster-nodejs-captcha-solver)
245
+ - [n8n](https://github.com/CapMonsterCloud/capmonster-n8n-captcha-solver)
246
+ - [API Docs](https://github.com/CapMonsterCloud/capmonster-captcha-solver-docs)
247
+
248
+ ---
249
+
250
+ ## 📄 License
251
+
252
+ [MIT](./LICENSE) © [ZennoLab](https://zennolab.com/) / [CapMonster Cloud](https://capmonster.cloud/en/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme)
@@ -0,0 +1,177 @@
1
+ # CapMonster Cloud Python SDK: AI Captcha Solver & Anti-Bot Bypass
2
+
3
+ <p align="center">
4
+ <a href="https://capmonster.cloud/en/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme">
5
+ <img src="https://img.shields.io/badge/CapMonster%20Cloud-Python%20Captcha%20Solver-00B2FF?style=for-the-badge&logo=python&logoColor=white" alt="CapMonster Cloud Python SDK" height="40">
6
+ </a>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <strong>Fast, AI-driven CAPTCHA solving client for Python. Seamlessly bypass Cloudflare Turnstile, reCAPTCHA v2/v3/Enterprise, DataDome, GeeTest, and Amazon WAF in web scraping and browser automation.</strong>
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://pypi.org/project/capmonstercloudclient/"><img src="https://img.shields.io/pypi/v/capmonstercloudclient.svg?style=flat-square&color=blue" alt="PyPI version"></a>
15
+ <a href="https://pepy.tech/project/capmonstercloudclient"><img src="https://static.pepy.tech/badge/capmonstercloudclient/month" alt="PyPI downloads"></a>
16
+ <a href="https://pypi.org/project/capmonstercloudclient/"><img src="https://img.shields.io/pypi/pyversions/capmonstercloudclient.svg?style=flat-square" alt="Python Versions"></a>
17
+ <a href="https://github.com/CapMonsterCloud/capmonster-python-captcha-solver/stargazers"><img src="https://img.shields.io/github/stars/CapMonsterCloud/capmonster-python-captcha-solver?style=flat-square&color=yellow" alt="GitHub Stars"></a>
18
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/License-MIT-orange.svg?style=flat-square" alt="License: MIT"></a>
19
+ </p>
20
+
21
+ ---
22
+
23
+ Official asynchronous Python SDK for [CapMonster Cloud](https://capmonster.cloud/en/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme). Easily plug ultra-fast AI captcha recognition into **Playwright, Selenium, Puppeteer, Scrapy, BeautifulSoup, and Requests** automation workflows without human-in-the-loop delays.
24
+
25
+ **[👉 Get your Free API Key & Free Trial Balance on CapMonster Cloud](https://dash.capmonster.cloud/Account/SignUp?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme)**
26
+
27
+ ---
28
+
29
+ ## ⚡ Highlights & Benchmarks
30
+
31
+ - ⚡ **Sub-Second Speed:** Automated AI models solve captchas in 300 ms to 6 seconds depending on the system load.
32
+ - 🤖 **Zero Human Workers:** 100% automated machine learning pipeline with no manual latencies.
33
+ - 🌐 **Browser Automation Ready:** Works out-of-the-box with **Playwright, Selenium, and Puppeteer**.
34
+ - 🛡️ **Modern Anti-Bot Bypass:** Full support for Cloudflare Turnstile, reCAPTCHA Enterprise, GeeTest, and Amazon WAF.
35
+ - 💰 **Cost-Effective:** Low-cost pricing structure based on pay-as-you-go balance.
36
+
37
+ ---
38
+
39
+ ## 📦 Installation
40
+
41
+ ```bash
42
+ pip install capmonstercloudclient
43
+ ```
44
+
45
+ ---
46
+
47
+ ## 🚀 Quick Start & Usage Examples
48
+
49
+ ### 1. Asynchronous reCAPTCHA v2 Solving
50
+
51
+ ```python
52
+ import asyncio
53
+ from capmonstercloudclient import CapMonsterClient, ClientOptions
54
+ from capmonstercloudclient.requests import RecaptchaV2Request
55
+
56
+ # Initialize client with your API key from dashboard
57
+ options = ClientOptions(api_key="YOUR_CAPMONSTER_API_KEY")
58
+ client = CapMonsterClient(options=options)
59
+
60
+ async def main():
61
+ # Build the task payload
62
+ request = RecaptchaV2Request(
63
+ websiteUrl="https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=high",
64
+ websiteKey="6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd"
65
+ )
66
+
67
+ # Send task and receive token
68
+ result = await client.solve_captcha(request)
69
+ print("reCAPTCHA Token:", result.get("gRecaptchaResponse"))
70
+
71
+ if __name__ == "__main__":
72
+ asyncio.run(main())
73
+ ```
74
+
75
+ ### 2. Browser Automation (Playwright + Cloudflare Turnstile)
76
+
77
+ ```python
78
+ import asyncio
79
+ from playwright.async_api import async_playwright
80
+ from capmonstercloudclient import CapMonsterClient, ClientOptions
81
+ from capmonstercloudclient.requests import TurnstileRequest
82
+
83
+ options = ClientOptions(api_key="YOUR_CAPMONSTER_API_KEY")
84
+ client = CapMonsterClient(options=options)
85
+
86
+ async def run_scraper():
87
+ # Solve Turnstile challenge via CapMonster Cloud
88
+ turnstile_req = TurnstileRequest(
89
+ websiteURL="https://target-website.com/login",
90
+ websiteKey="0x4AAAAAAABnPIDnK2k_e-2"
91
+ )
92
+ solution = await client.solve_captcha(turnstile_req)
93
+ token = solution.get("token")
94
+
95
+ # Inject token into Playwright browser session
96
+ async with async_playwright() as p:
97
+ browser = await p.chromium.launch(headless=False)
98
+ page = await browser.new_page()
99
+ await page.goto("https://target-website.com/login")
100
+
101
+ await page.evaluate(f'document.querySelector("[name=cf-turnstile-response]").value = "{token}";')
102
+ await page.click("#submit-button")
103
+ await browser.close()
104
+
105
+ if __name__ == "__main__":
106
+ asyncio.run(run_scraper())
107
+ ```
108
+
109
+ ---
110
+
111
+ ## 🛡️ Supported CAPTCHA Types
112
+
113
+ All task types conform to the official [CapMonster Cloud API Documentation](https://docs.capmonster.cloud/docs/captchas/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme):
114
+
115
+ | Protection Type | Task Request Class | Proxyless Mode |
116
+ | :--- | :--- | :---: |
117
+ | **Cloudflare Turnstile** | `TurnstileRequest` | ✅ Supported |
118
+ | **reCAPTCHA v2** | `RecaptchaV2Request` | ✅ Supported |
119
+ | **reCAPTCHA v3** | `RecaptchaV3ProxylessRequest` | ✅ Supported |
120
+ | **reCAPTCHA Enterprise** | `RecaptchaV2EnterpriseProxylessRequest` / `RecaptchaV2EnterpriseRequest` | ✅ Supported |
121
+ | **GeeTest (v3, v4)** | `GeeTestProxylessRequest` / `GeeTestRequest` | ✅ Supported |
122
+ | **Amazon WAF** | `AmazonWafRequest` | ✅ Supported |
123
+ | **DataDome** | `DataDomeCustomTaskRequest` | 🌐 Proxy Required |
124
+ | **Imperva / Incapsula** | `ImpervaCustomTaskRequest` / `ImpervaCustomTaskProxylessRequest` | ✅ Supported |
125
+ | **Binance CAPTCHA** | `BinanceTaskRequest` / `BinanceTaskProxylessRequest` | ✅ Supported |
126
+ | **Standard Text CAPTCHA** | `ImageToTextRequest` | ✅ Supported |
127
+ | **Complex Image Tasks** | `RecaptchaComplexImageTaskRequest` | ✅ Supported |
128
+
129
+ ---
130
+
131
+ ## 🛠️ How It Works
132
+
133
+ ```text
134
+ [ Script / Scraper ]
135
+ │
136
+ ▼
137
+ [ Extract sitekey & website URL ]
138
+ │
139
+ ▼
140
+ [ CapMonsterClient API ] ──► POST createTask to https://api.capmonster.cloud
141
+ │
142
+ ▼
143
+ [ Neural Network Processing ] ──► Poll getTaskResult (300ms - 6s)
144
+ │
145
+ ▼
146
+ [ Receive Token & Autosubmit ] ──► Complete bypass
147
+ ```
148
+
149
+ ---
150
+
151
+ ## ⚙️ Best Practices
152
+
153
+ - **Token Expiration:** Most tokens (reCAPTCHA, Turnstile) remain valid for 120 seconds. Inject and submit the solution immediately after receiving the response.
154
+ - **Proxy Usage:** For custom tasks and strict protections, use the same proxy in your scraping session and the CapMonster task payload.
155
+ - **Balance Monitoring:** Ensure your account balance remains positive in the [Dashboard](https://dash.capmonster.cloud/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme).
156
+
157
+ ---
158
+
159
+ ## 📚 Official Documentation & Links
160
+
161
+ - 📖 [Getting Started Guide](https://docs.capmonster.cloud/docs/getting-start/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme)
162
+ - 🎯 [Supported Captchas Overview](https://docs.capmonster.cloud/docs/captchas/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme)
163
+ - ⚙️ [API Methods Reference](https://docs.capmonster.cloud/docs/methods/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme)
164
+ - 💬 [Support & Community](https://capmonster.cloud/en/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme#support)
165
+
166
+ ## Other official SDKs
167
+
168
+ - [.NET](https://github.com/CapMonsterCloud/capmonster-dotnet-captcha-solver)
169
+ - [Node.js](https://github.com/CapMonsterCloud/capmonster-nodejs-captcha-solver)
170
+ - [n8n](https://github.com/CapMonsterCloud/capmonster-n8n-captcha-solver)
171
+ - [API Docs](https://github.com/CapMonsterCloud/capmonster-captcha-solver-docs)
172
+
173
+ ---
174
+
175
+ ## 📄 License
176
+
177
+ [MIT](./LICENSE) © [ZennoLab](https://zennolab.com/) / [CapMonster Cloud](https://capmonster.cloud/en/?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme)
@@ -5,7 +5,7 @@ from .CustomTaskRequestBase import CustomTaskRequestBase
5
5
 
6
6
  ALLOWED_METADATA_KEYS = {
7
7
  'sceneId', 'prefix', 'userId', 'userUserId', 'verifyType',
8
- 'region', 'UserCertifyId', 'apiGetLib', 'cookieRequired',
8
+ 'region', 'UserCertifyId', 'apiGetLib', 'cookieRequired', 'punishUrl',
9
9
  }
10
10
 
11
11
  class AlibabaCustomTaskRequest(CustomTaskRequestBase):
@@ -15,29 +15,35 @@ class AlibabaCustomTaskRequest(CustomTaskRequestBase):
15
15
  Attributes:
16
16
  captchaClass: The constant string value identifying the captcha
17
17
  class as "alibaba".
18
- metadata: A dictionary of Alibaba-specific parameters. Requires sceneId
19
- and prefix; userId, userUserId, verifyType, region, UserCertifyId,
20
- apiGetLib, and cookieRequired are optional, needed only for sites
21
- that use them.
18
+ metadata: A dictionary of Alibaba-specific parameters. Standard mode
19
+ requires sceneId and prefix; userId, userUserId, verifyType, region,
20
+ UserCertifyId, apiGetLib, and cookieRequired are optional, needed
21
+ only for sites that use them. Alternatively, for websites that
22
+ trigger verification through a separate "/punish" URL, pass only
23
+ punishUrl (the full punish page URL) instead of sceneId/prefix.
22
24
  """
23
25
  captchaClass: str = Field(default='alibaba', description='The constant string value identifying the captcha class as "alibaba".')
24
- metadata: Dict[str, Union[str, bool]] = Field(..., description='A dictionary of Alibaba-specific parameters. Requires sceneId and prefix; userId, userUserId, verifyType, region, UserCertifyId, apiGetLib, and cookieRequired are optional, needed only for sites that use them.')
26
+ metadata: Dict[str, Union[str, bool]] = Field(..., description='A dictionary of Alibaba-specific parameters. Requires sceneId and prefix, unless punishUrl is provided instead. userId, userUserId, verifyType, region, UserCertifyId, apiGetLib, and cookieRequired are optional, needed only for sites that use them.')
25
27
 
26
28
  @field_validator('metadata')
27
29
  @classmethod
28
30
  def validate_metadata(cls, value):
29
31
  if not set(value.keys()).issubset(ALLOWED_METADATA_KEYS):
30
32
  raise TypeError(f'Allowed keys for metadata are {sorted(ALLOWED_METADATA_KEYS)}')
31
- if value.get('sceneId') is None:
32
- raise TypeError(f'sceneId must be defined inside metadata.')
33
+ if value.get('punishUrl') is not None:
34
+ if not isinstance(value.get('punishUrl'), str):
35
+ raise TypeError(f'punishUrl must be str.')
33
36
  else:
34
- if not isinstance(value.get('sceneId'), str):
35
- raise TypeError(f'sceneId must be str.')
36
- if value.get('prefix') is None:
37
- raise TypeError(f'prefix must be defined inside metadata.')
38
- else:
39
- if not isinstance(value.get('prefix'), str):
40
- raise TypeError(f'prefix must be str.')
37
+ if value.get('sceneId') is None:
38
+ raise TypeError(f'sceneId must be defined inside metadata (unless punishUrl is used).')
39
+ else:
40
+ if not isinstance(value.get('sceneId'), str):
41
+ raise TypeError(f'sceneId must be str.')
42
+ if value.get('prefix') is None:
43
+ raise TypeError(f'prefix must be defined inside metadata (unless punishUrl is used).')
44
+ else:
45
+ if not isinstance(value.get('prefix'), str):
46
+ raise TypeError(f'prefix must be str.')
41
47
  if value.get('cookieRequired') is not None and not isinstance(value.get('cookieRequired'), bool):
42
48
  raise TypeError(f'cookieRequired must be bool.')
43
49
  return value
@@ -1,5 +1,5 @@
1
1
  from typing import Dict, Union, Optional
2
- from pydantic import Field
2
+ from pydantic import Field, model_validator
3
3
 
4
4
  from .baseRequestWithProxy import BaseRequestWithProxy
5
5
 
@@ -22,6 +22,7 @@ class FuncaptchaRequest(BaseRequestWithProxy):
22
22
  provided as a string of key-value pairs.
23
23
  userAgent: Browser User-Agent to emulate. Pass only a current
24
24
  Windows OS UA.
25
+ proxy: Required. Your own proxy used to solve the task.
25
26
  """
26
27
  type: str = Field(default='FunCaptchaTask', description='The task type identifier, "FunCaptchaTask".')
27
28
  websiteUrl: str = Field(..., description='The URL of the webpage containing the FunCaptcha challenge.')
@@ -31,18 +32,23 @@ class FuncaptchaRequest(BaseRequestWithProxy):
31
32
  cookies: Optional[str] = Field(default=None, description='Cookies to be used when accessing the target webpage, provided as a string of key-value pairs.')
32
33
  userAgent: Optional[str] = Field(default=None, description='Browser User-Agent to emulate. Pass only a current Windows OS UA.')
33
34
 
35
+ @model_validator(mode='before')
36
+ def validate_funcaptcha_proxy(cls, values):
37
+ if values.get('proxy') is None:
38
+ raise RuntimeError(f'You are required to use your own proxies to solve FunCaptcha.')
39
+ return values
40
+
34
41
  def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
35
42
  task = {}
36
43
  task['type'] = self.type
37
44
  task['websiteURL'] = self.websiteUrl
38
45
  task['websitePublicKey'] = self.websitePublicKey
39
- if self.proxy:
40
- task['proxyType'] = self.proxy.proxyType
41
- task['proxyAddress'] = self.proxy.proxyAddress
42
- task['proxyPort'] = self.proxy.proxyPort
43
- task['proxyLogin'] = self.proxy.proxyLogin
44
- task['proxyPassword'] = self.proxy.proxyPassword
45
-
46
+ task['proxyType'] = self.proxy.proxyType
47
+ task['proxyAddress'] = self.proxy.proxyAddress
48
+ task['proxyPort'] = self.proxy.proxyPort
49
+ task['proxyLogin'] = self.proxy.proxyLogin
50
+ task['proxyPassword'] = self.proxy.proxyPassword
51
+
46
52
  if self.funcaptchaApiJSSubdomain is not None:
47
53
  task['funcaptchaApiJSSubdomain'] = self.funcaptchaApiJSSubdomain
48
54
  if self.data is not None:
@@ -12,13 +12,14 @@ class HuntCustomTaskRequest(CustomTaskRequestBase):
12
12
  captcha class as "HUNT".
13
13
  metadata: A dictionary of parameters required by the HUNT solver.
14
14
  Always requires "apiGetLib" (the URL of the HUNT JS script on
15
- the page). HUNT has two solving modes: fingerprint generation
16
- (only "apiGetLib" needed) and captcha solving (also requires
17
- "data", which must hold the "meta.token" value extracted from
18
- the page).
15
+ the page). HUNT has three solving modes: fingerprint generation
16
+ (only "apiGetLib" needed), captcha solving via "data" (which must
17
+ hold the "meta.token" value extracted from the page), and captcha
18
+ solving via "widgetUrl" (the full Hunt CAPTCHA widget URL). "data"
19
+ and "widgetUrl" must not be used together.
19
20
  """
20
21
  captchaClass: str = Field(default='HUNT', description='The constant string value identifying the underlying captcha class as "HUNT".')
21
- metadata: Dict[str, str] = Field(..., description='Dictionary of HUNT parameters. Always requires "apiGetLib". Also requires "data" (the "meta.token" value from the page) when solving a captcha rather than just generating a fingerprint.')
22
+ metadata: Dict[str, str] = Field(..., description='Dictionary of HUNT parameters. Always requires "apiGetLib". Also requires exactly one of "data" (the "meta.token" value from the page) or "widgetUrl" (the full Hunt CAPTCHA widget URL) when solving a captcha rather than just generating a fingerprint.')
22
23
 
23
24
  @field_validator('metadata')
24
25
  @classmethod
@@ -30,6 +31,10 @@ class HuntCustomTaskRequest(CustomTaskRequestBase):
30
31
  raise TypeError(f'apiGetLib must be str.')
31
32
  if value.get('data') is not None and not isinstance(value.get('data'), str):
32
33
  raise TypeError(f'data must be str.')
34
+ if value.get('widgetUrl') is not None and not isinstance(value.get('widgetUrl'), str):
35
+ raise TypeError(f'widgetUrl must be str.')
36
+ if value.get('data') is not None and value.get('widgetUrl') is not None:
37
+ raise TypeError(f'"data" and "widgetUrl" must not be used together.')
33
38
  return value
34
39
 
35
40
  @model_validator(mode='before')
@@ -10,26 +10,27 @@ class RecaptchaComplexImageTaskRequest(ComplexImageTaskRequestBase):
10
10
  image classification challenges.
11
11
 
12
12
  Attributes:
13
- metadata: A dictionary describing the challenge. Must contain
14
- "Task" (English task name, e.g. "Click on traffic lights") and
15
- "TaskDefinition" (its technical identifier, e.g. "/m/015qff") —
16
- both required together — along with "Grid" (e.g. "3x3", "4x4",
17
- "1x1") specifying the image grid layout.
13
+ metadata: A dictionary describing the challenge. Must contain at
14
+ least one of "Task" (English task name, e.g. "Click on traffic
15
+ lights") or "TaskDefinition" (its technical identifier, e.g.
16
+ "/m/015qff") — each is required only if the other is not filled —
17
+ along with "Grid" (e.g. "3x3", "4x4", "1x1") specifying the image
18
+ grid layout.
18
19
  captchaClass: The constant string identifying the captcha family
19
20
  as "recaptcha".
20
21
  imagesUrls: A collection of image URLs to be recognized. Must be
21
22
  populated if imagesBase64 is not.
22
23
  """
23
24
 
24
- metadata : Dict[str, str] = Field(..., description='Dictionary describing the challenge. Must contain "Task" and "TaskDefinition" (both required together) plus "Grid".')
25
+ metadata : Dict[str, str] = Field(..., description='Dictionary describing the challenge. Must contain at least one of "Task" or "TaskDefinition" (each required only if the other is not filled) plus "Grid".')
25
26
  captchaClass: str = Field(default='recaptcha', description='Constant string identifying the captcha family as "recaptcha".')
26
27
  imagesUrls: Optional[List[str]] = Field(default=None, description='Collection with image urls. Must be populated if imagesBase64 is not.')
27
28
 
28
29
  @field_validator('metadata')
29
30
  @classmethod
30
31
  def validate_metadata(cls, value):
31
- if value.get('Task') is None or value.get('TaskDefinition') is None:
32
- raise TaskNotDefinedError(f'"Task" and "TaskDefinition" must both be filled.')
32
+ if value.get('Task') is None and value.get('TaskDefinition') is None:
33
+ raise TaskNotDefinedError(f'At least one of "Task" or "TaskDefinition" must be filled.')
33
34
  elif value.get('Grid') is None:
34
35
  raise TaskNotDefinedError(f'"Grid" must be filled (3x3, 4x4, 1x1).')
35
36
  else: