capmonstercloudclient 4.1.0__tar.gz → 4.2.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.
- capmonstercloudclient-4.2.0/PKG-INFO +177 -0
- capmonstercloudclient-4.2.0/README.md +93 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/CapMonsterCloudClient.py +17 -8
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/GetResultTimeouts.py +13 -32
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/clientOptions.py +7 -4
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/AlibabaCustomTaskRequest.py +59 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/AltchaCustomTaskRequest.py +51 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/AmazonWafRequest.py +98 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requests/BasiliskCustomTaskRequest.py +13 -2
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/BinanceTaskRequest.py +41 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requests/CastleCustomTaskRequest.py +18 -5
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/ComplexImageTaskBase.py +25 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/CustomTaskRequestBase.py +27 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/DataDomeCustomTaskRequest.py +54 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/FriendlyCustomTaskRequest.py +49 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requests/FuncaptchaComplexImageTask.py +28 -11
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/FuncaptchaRequest.py +54 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/GeetestRequest.py +74 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/HcaptchaComplexImageTask.py +121 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/HcaptchaRequest.py +57 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/HuntCustomTaskRequest.py +55 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/ImageToTextRequest.py +93 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/ImpervaCustomTaskRequest.py +59 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/MTCaptchaRequest.py +47 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/ProsopoTaskRequest.py +32 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requests/RecaptchaComplexImageTask.py +33 -14
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/RecaptchaV2EnterpiseRequest.py +65 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/RecaptchaV2Request.py +60 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/RecaptchaV3EnterpriseRequest.py +45 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/RecaptchaV3ProxylessRequest.py +50 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requests/RecognitionComplexImageTaskRequest.py +25 -10
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requests/TemuCustomTaskRequest.py +19 -6
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requests/TenDiCustomTaskRequest.py +18 -6
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/TspdCustomTaskRequest.py +60 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/TurnstileRequest.py +107 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/YidunRequest.py +64 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requests/__init__.py +6 -3
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/baseRequest.py +23 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/baseRequestWithProxy.py +16 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requests/enums.py +13 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/proxy_info.py +68 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/version.txt +1 -0
- capmonstercloudclient-4.2.0/capmonstercloudclient.egg-info/PKG-INFO +177 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloudclient.egg-info/SOURCES.txt +3 -1
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloudclient.egg-info/requires.txt +16 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/requirements.txt +16 -1
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/setup.py +7 -2
- capmonstercloudclient-4.1.0/PKG-INFO +0 -140
- capmonstercloudclient-4.1.0/README.md +0 -75
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/AlibabaCustomTaskRequest.py +0 -42
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/AltchaCustomTaskRequest.py +0 -36
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/AmazonWafRequest.py +0 -35
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/BinanceTaskRequest.py +0 -29
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/ComplexImageTaskBase.py +0 -11
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/CustomTaskRequestBase.py +0 -10
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/DataDomeCustomTaskRequest.py +0 -46
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/FriendlyCaptchaRequest.py +0 -35
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/FuncaptchaRequest.py +0 -32
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/GeetestRequest.py +0 -53
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/HuntCustomTaskRequest.py +0 -41
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/ImageToTextRequest.py +0 -68
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/ImpervaCustomTaskRequest.py +0 -46
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/MTCaptchaRequest.py +0 -32
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/ProsopoTaskRequest.py +0 -23
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/RecaptchaV2EnterpiseRequest.py +0 -37
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/RecaptchaV2Request.py +0 -41
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/RecaptchaV3EnterpriseRequest.py +0 -22
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/RecaptchaV3ProxylessRequest.py +0 -30
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/TspdCustomTaskRequest.py +0 -44
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/TurnstileRequest.py +0 -81
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/YidunRequest.py +0 -41
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/baseRequest.py +0 -11
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/baseRequestWithProxy.py +0 -7
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/proxy_info.py +0 -41
- capmonstercloudclient-4.1.0/capmonstercloud_client/version.txt +0 -1
- capmonstercloudclient-4.1.0/capmonstercloudclient.egg-info/PKG-INFO +0 -140
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/LICENSE +0 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/MANIFEST.in +0 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/__init__.py +0 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/captchaResult.py +0 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/exceptions.py +0 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requestController.py +0 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/utils.py +0 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloudclient.egg-info/dependency_links.txt +0 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloudclient.egg-info/top_level.txt +0 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/pyproject.toml +0 -0
- {capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/setup.cfg +0 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: capmonstercloudclient
|
|
3
|
+
Version: 4.2.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
|
|
10
|
+
recaptcha
|
|
11
|
+
geetest
|
|
12
|
+
hcaptcha
|
|
13
|
+
funcaptcha
|
|
14
|
+
python3
|
|
15
|
+
python-library
|
|
16
|
+
capmonster
|
|
17
|
+
capmonstercloud
|
|
18
|
+
capmonstercloudclient
|
|
19
|
+
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
|
|
20
|
+
Classifier: Programming Language :: Python
|
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
|
22
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
29
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
30
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
31
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
32
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
33
|
+
Classifier: Framework :: AsyncIO
|
|
34
|
+
Classifier: Operating System :: Unix
|
|
35
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
36
|
+
Classifier: Operating System :: MacOS
|
|
37
|
+
Requires-Python: >=3.6
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
License-File: LICENSE
|
|
40
|
+
Requires-Dist: aiohappyeyeballs==2.4.4; python_version >= "3.9" and python_version <= "3.13"
|
|
41
|
+
Requires-Dist: aiohttp==3.11.10; python_version >= "3.9" and python_version <= "3.13"
|
|
42
|
+
Requires-Dist: aiosignal==1.3.1; python_version >= "3.9" and python_version <= "3.13"
|
|
43
|
+
Requires-Dist: annotated-types==0.7.0; python_version >= "3.9" and python_version <= "3.13"
|
|
44
|
+
Requires-Dist: async-timeout==5.0.1; python_version >= "3.9" and python_version <= "3.11"
|
|
45
|
+
Requires-Dist: attrs==24.2.0; python_version >= "3.9" and python_version <= "3.13"
|
|
46
|
+
Requires-Dist: frozenlist==1.5.0; python_version >= "3.9" and python_version <= "3.13"
|
|
47
|
+
Requires-Dist: idna==3.10; python_version >= "3.9" and python_version <= "3.13"
|
|
48
|
+
Requires-Dist: multidict==6.1.0; python_version >= "3.9" and python_version <= "3.13"
|
|
49
|
+
Requires-Dist: propcache==0.2.1; python_version >= "3.9" and python_version <= "3.13"
|
|
50
|
+
Requires-Dist: pydantic-core==2.27.1; python_version >= "3.9" and python_version <= "3.13"
|
|
51
|
+
Requires-Dist: pydantic==2.10.3; python_version >= "3.9" and python_version <= "3.13"
|
|
52
|
+
Requires-Dist: typing-extensions==4.12.2; python_version >= "3.9" and python_version <= "3.13"
|
|
53
|
+
Requires-Dist: yarl==1.18.3; python_version >= "3.9" and python_version <= "3.13"
|
|
54
|
+
Requires-Dist: aiohttp==3.7.4; python_version >= "3.6" and python_version <= "3.8"
|
|
55
|
+
Requires-Dist: pydantic==2.10.3; python_version >= "3.8" and python_version < "3.9"
|
|
56
|
+
Requires-Dist: pydantic==2.5.3; python_version >= "3.7" and python_version < "3.8"
|
|
57
|
+
Requires-Dist: pydantic==2.1.*; python_version < "3.7"
|
|
58
|
+
Requires-Dist: aiohappyeyeballs==2.7.1; python_version == "3.14"
|
|
59
|
+
Requires-Dist: aiohttp==3.14.3; python_version == "3.14"
|
|
60
|
+
Requires-Dist: aiosignal==1.4.0; python_version == "3.14"
|
|
61
|
+
Requires-Dist: annotated-types==0.8.0; python_version == "3.14"
|
|
62
|
+
Requires-Dist: attrs==26.1.0; python_version == "3.14"
|
|
63
|
+
Requires-Dist: frozenlist==1.8.0; python_version == "3.14"
|
|
64
|
+
Requires-Dist: idna==3.18; python_version == "3.14"
|
|
65
|
+
Requires-Dist: multidict==6.7.1; python_version == "3.14"
|
|
66
|
+
Requires-Dist: propcache==0.5.2; python_version == "3.14"
|
|
67
|
+
Requires-Dist: pydantic-core==2.46.4; python_version == "3.14"
|
|
68
|
+
Requires-Dist: pydantic==2.13.4; python_version == "3.14"
|
|
69
|
+
Requires-Dist: typing-extensions==4.16.0; python_version == "3.14"
|
|
70
|
+
Requires-Dist: typing-inspection==0.4.2; python_version == "3.14"
|
|
71
|
+
Requires-Dist: yarl==1.24.5; python_version == "3.14"
|
|
72
|
+
Dynamic: author
|
|
73
|
+
Dynamic: author-email
|
|
74
|
+
Dynamic: classifier
|
|
75
|
+
Dynamic: description
|
|
76
|
+
Dynamic: description-content-type
|
|
77
|
+
Dynamic: home-page
|
|
78
|
+
Dynamic: keywords
|
|
79
|
+
Dynamic: license
|
|
80
|
+
Dynamic: license-file
|
|
81
|
+
Dynamic: requires-dist
|
|
82
|
+
Dynamic: requires-python
|
|
83
|
+
Dynamic: summary
|
|
84
|
+
|
|
85
|
+
# CapMonster Python Captcha Solver & Anti-Bot Bypass API Library
|
|
86
|
+
|
|
87
|
+
[](https://pypi.org/project/capmonstercloudclient/)
|
|
88
|
+
[](https://pypi.org/project/capmonstercloudclient/)
|
|
89
|
+
[](https://pypi.org/project/capmonstercloudclient/)
|
|
90
|
+
[](https://opensource.org/licenses/MIT)
|
|
91
|
+
|
|
92
|
+
Official Python 3 package for easy integration with the [CapMonster Cloud](https://capmonster.cloud/) API — the fastest and most reliable automated captcha-solving service.
|
|
93
|
+
|
|
94
|
+
This wrapper allows you to seamlessly integrate high-speed AI captcha recognition into your Python web scraping, data extraction, and testing workflows. It is fully compatible with popular browser automation frameworks like **Selenium, Playwright, Puppeteer, Scrapy, and BeautifulSoup**.
|
|
95
|
+
|
|
96
|
+
🔥 **[Create a Free Account & Get Your API Key](https://dash.capmonster.cloud/Account/SignUp?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme)** to start bypassing bot protections instantly!
|
|
97
|
+
|
|
98
|
+
## 🛠️ Key Features
|
|
99
|
+
|
|
100
|
+
- ⚡ **Fast & Fully Automated:** Solve captchas in seconds without human intervention.
|
|
101
|
+
- 🤖 **100% AI-Powered:** Machine learning algorithms ensure the highest success rate.
|
|
102
|
+
- 🌐 **Browser Automation Ready:** Easily plug into your Selenium or Playwright scripts.
|
|
103
|
+
- 🛡️ **Advanced WAF Bypass:** Effortlessly bypass Cloudflare Turnstile, DataDome, Amazon WAF, and Imperva.
|
|
104
|
+
- 💰 **Cost-Effective:** One of the most affordable solutions on the market for scale.
|
|
105
|
+
|
|
106
|
+
## ⚙️ Installation
|
|
107
|
+
|
|
108
|
+
Install the CapMonster Cloud Python client using pip:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
pip install capmonstercloudclient
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## 🚀 Quick Start & Usage Example
|
|
115
|
+
|
|
116
|
+
**Prerequisite:** You need an active CapMonster API key. [Grab it from your dashboard](https://dash.capmonster.cloud/Account/SignUp?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme).
|
|
117
|
+
|
|
118
|
+
Below is a standard example of solving a reCAPTCHA v2 (Proxyless) using `asyncio`. You can easily pass the resulting token into your Selenium or Playwright browser instances.
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
import asyncio
|
|
122
|
+
|
|
123
|
+
from capmonstercloudclient import CapMonsterClient, ClientOptions
|
|
124
|
+
from capmonstercloudclient.requests import RecaptchaV2ProxylessRequest
|
|
125
|
+
|
|
126
|
+
# Initialize the client with your CapMonster Cloud API key
|
|
127
|
+
client_options = ClientOptions(api_key="<YOUR_API_KEY>")
|
|
128
|
+
cap_monster_client = CapMonsterClient(options=client_options)
|
|
129
|
+
|
|
130
|
+
async def solve_captcha():
|
|
131
|
+
# Setup the reCAPTCHA v2 request
|
|
132
|
+
recaptcha2request = RecaptchaV2ProxylessRequest(
|
|
133
|
+
websiteUrl="https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=high",
|
|
134
|
+
websiteKey="6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd"
|
|
135
|
+
)
|
|
136
|
+
# Await the solution token
|
|
137
|
+
return await cap_monster_client.solve_captcha(recaptcha2request)
|
|
138
|
+
|
|
139
|
+
if __name__ == "__main__":
|
|
140
|
+
responses = asyncio.run(solve_captcha())
|
|
141
|
+
print("Captcha Solved! Token:", responses)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## 🧩 Supported Captcha Recognition Types
|
|
145
|
+
|
|
146
|
+
Our Python API wrapper supports almost all modern anti-bot challenges. Click on the links below to view detailed API documentation and payload examples.
|
|
147
|
+
|
|
148
|
+
### 🔹 Classic Captchas
|
|
149
|
+
- [AmazonWafRequest](https://docs.capmonster.cloud/docs/captchas/amazon-task) - Amazon WAF Bypass
|
|
150
|
+
- [BinanceTaskRequest](https://docs.capmonster.cloud/docs/captchas/binance) - Binance Captcha Solver
|
|
151
|
+
- [BinanceTaskProxylessRequest](https://docs.capmonster.cloud/docs/captchas/binance)
|
|
152
|
+
- [GeeTestProxylessRequest](https://zenno.link/doc-geetest-en) - GeeTest Solver
|
|
153
|
+
- [GeeTestRequest](https://zenno.link/doc-geetest-proxy-en)
|
|
154
|
+
- [ImageToTextRequest](https://zenno.link/doc-ImageToTextTask-en) - Standard OCR (Image-to-Text)
|
|
155
|
+
- [RecaptchaV2ProxylessRequest](https://zenno.link/doc-recaptcha2-en) - Google reCAPTCHA v2
|
|
156
|
+
- [RecaptchaV2Request](https://zenno.link/doc-recaptcha2-proxy-en)
|
|
157
|
+
- [RecaptchaV3ProxylessRequest](https://zenno.link/doc-recaptcha3-en) - Google reCAPTCHA v3
|
|
158
|
+
- [RecaptchaV2EnterpriseProxylessRequest](https://zenno.link/doc-recaptcha2e-en)
|
|
159
|
+
- [RecaptchaV2EnterpriseRequest](https://zenno.link/doc-recaptcha2e-proxy-en)
|
|
160
|
+
- [TurnstileProxylessRequest](https://zenno.link/doc-turnstile-en) - Cloudflare Turnstile Challenge
|
|
161
|
+
- [TurnstileRequest](https://zenno.link/doc-turnstile-proxy-en)
|
|
162
|
+
|
|
163
|
+
### 🔹 Custom Tasks (Anti-Bot & Advanced WAFs)
|
|
164
|
+
- [BasiliskCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/Basilisk-task)
|
|
165
|
+
- [DataDomeCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/datadome) - DataDome Slider & Interstitial bypass
|
|
166
|
+
- [ImpervaCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/incapsula) - Imperva / Incapsula bypass
|
|
167
|
+
- [ImpervaCustomTaskProxylessRequest](https://docs.capmonster.cloud/docs/captchas/incapsula)
|
|
168
|
+
- [TenDiCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/tendi)
|
|
169
|
+
|
|
170
|
+
### 🔹 Complex Image Tasks
|
|
171
|
+
- [RecaptchaComplexImageTaskRequest](https://zenno.link/doc-complextask-rc-en) (Grid / Dynamic Image Selection)
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### 💡 Ready to supercharge your web automation?
|
|
176
|
+
Join thousands of developers effortlessly bypassing captchas.
|
|
177
|
+
👉 **[Sign up for CapMonster Cloud](https://capmonster.cloud/) today and boost your scraper's success rate!**
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# CapMonster Python Captcha Solver & Anti-Bot Bypass API Library
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/capmonstercloudclient/)
|
|
4
|
+
[](https://pypi.org/project/capmonstercloudclient/)
|
|
5
|
+
[](https://pypi.org/project/capmonstercloudclient/)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
Official Python 3 package for easy integration with the [CapMonster Cloud](https://capmonster.cloud/) API — the fastest and most reliable automated captcha-solving service.
|
|
9
|
+
|
|
10
|
+
This wrapper allows you to seamlessly integrate high-speed AI captcha recognition into your Python web scraping, data extraction, and testing workflows. It is fully compatible with popular browser automation frameworks like **Selenium, Playwright, Puppeteer, Scrapy, and BeautifulSoup**.
|
|
11
|
+
|
|
12
|
+
🔥 **[Create a Free Account & Get Your API Key](https://dash.capmonster.cloud/Account/SignUp?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme)** to start bypassing bot protections instantly!
|
|
13
|
+
|
|
14
|
+
## 🛠️ Key Features
|
|
15
|
+
|
|
16
|
+
- ⚡ **Fast & Fully Automated:** Solve captchas in seconds without human intervention.
|
|
17
|
+
- 🤖 **100% AI-Powered:** Machine learning algorithms ensure the highest success rate.
|
|
18
|
+
- 🌐 **Browser Automation Ready:** Easily plug into your Selenium or Playwright scripts.
|
|
19
|
+
- 🛡️ **Advanced WAF Bypass:** Effortlessly bypass Cloudflare Turnstile, DataDome, Amazon WAF, and Imperva.
|
|
20
|
+
- 💰 **Cost-Effective:** One of the most affordable solutions on the market for scale.
|
|
21
|
+
|
|
22
|
+
## ⚙️ Installation
|
|
23
|
+
|
|
24
|
+
Install the CapMonster Cloud Python client using pip:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install capmonstercloudclient
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 🚀 Quick Start & Usage Example
|
|
31
|
+
|
|
32
|
+
**Prerequisite:** You need an active CapMonster API key. [Grab it from your dashboard](https://dash.capmonster.cloud/Account/SignUp?utm_source=github&utm_medium=referral&utm_campaign=python_repo_readme).
|
|
33
|
+
|
|
34
|
+
Below is a standard example of solving a reCAPTCHA v2 (Proxyless) using `asyncio`. You can easily pass the resulting token into your Selenium or Playwright browser instances.
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
import asyncio
|
|
38
|
+
|
|
39
|
+
from capmonstercloudclient import CapMonsterClient, ClientOptions
|
|
40
|
+
from capmonstercloudclient.requests import RecaptchaV2ProxylessRequest
|
|
41
|
+
|
|
42
|
+
# Initialize the client with your CapMonster Cloud API key
|
|
43
|
+
client_options = ClientOptions(api_key="<YOUR_API_KEY>")
|
|
44
|
+
cap_monster_client = CapMonsterClient(options=client_options)
|
|
45
|
+
|
|
46
|
+
async def solve_captcha():
|
|
47
|
+
# Setup the reCAPTCHA v2 request
|
|
48
|
+
recaptcha2request = RecaptchaV2ProxylessRequest(
|
|
49
|
+
websiteUrl="https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=high",
|
|
50
|
+
websiteKey="6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd"
|
|
51
|
+
)
|
|
52
|
+
# Await the solution token
|
|
53
|
+
return await cap_monster_client.solve_captcha(recaptcha2request)
|
|
54
|
+
|
|
55
|
+
if __name__ == "__main__":
|
|
56
|
+
responses = asyncio.run(solve_captcha())
|
|
57
|
+
print("Captcha Solved! Token:", responses)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 🧩 Supported Captcha Recognition Types
|
|
61
|
+
|
|
62
|
+
Our Python API wrapper supports almost all modern anti-bot challenges. Click on the links below to view detailed API documentation and payload examples.
|
|
63
|
+
|
|
64
|
+
### 🔹 Classic Captchas
|
|
65
|
+
- [AmazonWafRequest](https://docs.capmonster.cloud/docs/captchas/amazon-task) - Amazon WAF Bypass
|
|
66
|
+
- [BinanceTaskRequest](https://docs.capmonster.cloud/docs/captchas/binance) - Binance Captcha Solver
|
|
67
|
+
- [BinanceTaskProxylessRequest](https://docs.capmonster.cloud/docs/captchas/binance)
|
|
68
|
+
- [GeeTestProxylessRequest](https://zenno.link/doc-geetest-en) - GeeTest Solver
|
|
69
|
+
- [GeeTestRequest](https://zenno.link/doc-geetest-proxy-en)
|
|
70
|
+
- [ImageToTextRequest](https://zenno.link/doc-ImageToTextTask-en) - Standard OCR (Image-to-Text)
|
|
71
|
+
- [RecaptchaV2ProxylessRequest](https://zenno.link/doc-recaptcha2-en) - Google reCAPTCHA v2
|
|
72
|
+
- [RecaptchaV2Request](https://zenno.link/doc-recaptcha2-proxy-en)
|
|
73
|
+
- [RecaptchaV3ProxylessRequest](https://zenno.link/doc-recaptcha3-en) - Google reCAPTCHA v3
|
|
74
|
+
- [RecaptchaV2EnterpriseProxylessRequest](https://zenno.link/doc-recaptcha2e-en)
|
|
75
|
+
- [RecaptchaV2EnterpriseRequest](https://zenno.link/doc-recaptcha2e-proxy-en)
|
|
76
|
+
- [TurnstileProxylessRequest](https://zenno.link/doc-turnstile-en) - Cloudflare Turnstile Challenge
|
|
77
|
+
- [TurnstileRequest](https://zenno.link/doc-turnstile-proxy-en)
|
|
78
|
+
|
|
79
|
+
### 🔹 Custom Tasks (Anti-Bot & Advanced WAFs)
|
|
80
|
+
- [BasiliskCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/Basilisk-task)
|
|
81
|
+
- [DataDomeCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/datadome) - DataDome Slider & Interstitial bypass
|
|
82
|
+
- [ImpervaCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/incapsula) - Imperva / Incapsula bypass
|
|
83
|
+
- [ImpervaCustomTaskProxylessRequest](https://docs.capmonster.cloud/docs/captchas/incapsula)
|
|
84
|
+
- [TenDiCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/tendi)
|
|
85
|
+
|
|
86
|
+
### 🔹 Complex Image Tasks
|
|
87
|
+
- [RecaptchaComplexImageTaskRequest](https://zenno.link/doc-complextask-rc-en) (Grid / Dynamic Image Selection)
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
### 💡 Ready to supercharge your web automation?
|
|
92
|
+
Join thousands of developers effortlessly bypassing captchas.
|
|
93
|
+
👉 **[Sign up for CapMonster Cloud](https://capmonster.cloud/) today and boost your scraper's success rate!**
|
|
@@ -20,9 +20,11 @@ _instance_config = (
|
|
|
20
20
|
((RecaptchaV3EnterpriseRequest,), getRecaptchaV3Timeouts),
|
|
21
21
|
((ImageToTextRequest,), getImage2TextTimeouts),
|
|
22
22
|
((FuncaptchaRequest,), getFuncaptchaTimeouts),
|
|
23
|
+
((HcaptchaRequest,), getHcaptchaTimeouts),
|
|
23
24
|
((GeetestRequest,), getGeetestTimeouts),
|
|
24
25
|
((TurnstileRequest,), getTurnstileTimeouts),
|
|
25
|
-
((RecaptchaComplexImageTaskRequest,
|
|
26
|
+
((RecaptchaComplexImageTaskRequest, HcaptchaComplexImageTaskRequest,
|
|
27
|
+
FunCaptchaComplexImageTaskRequest), getImage2TextTimeouts),
|
|
26
28
|
((DataDomeCustomTaskRequest,), getDatadomeTimeouts),
|
|
27
29
|
((TenDiCustomTaskRequest,), getTenDiTimeouts),
|
|
28
30
|
((BasiliskCustomTaskRequest,), getBasiliskTimeouts),
|
|
@@ -30,7 +32,7 @@ _instance_config = (
|
|
|
30
32
|
((BinanceTaskRequest,), getBinanceTimeouts),
|
|
31
33
|
((ImpervaCustomTaskRequest,), getImpervaTimeouts),
|
|
32
34
|
((RecognitionComplexImageTaskRequest,), getCITTimeouts),
|
|
33
|
-
((MTCaptchaRequest,),
|
|
35
|
+
((MTCaptchaRequest,), getMTCaptchaTimeouts),
|
|
34
36
|
((YidunRequest,), getYidunTimeouts),
|
|
35
37
|
((TemuCustomTaskRequest,), getTemuTimeouts),
|
|
36
38
|
((ProsopoTaskRequest,), getProsopoTimeouts),
|
|
@@ -38,8 +40,8 @@ _instance_config = (
|
|
|
38
40
|
((CastleCustomTaskRequest,), getCastleTimeouts),
|
|
39
41
|
((TspdCustomTaskRequest,), getTspdTimeouts),
|
|
40
42
|
((HuntCustomTaskRequest,), getHuntTimeouts),
|
|
41
|
-
((FriendlyCaptchaRequest,), getFriendlyCaptchaTimeouts),
|
|
42
43
|
((AlibabaCustomTaskRequest,), getAlibabaTimeouts),
|
|
44
|
+
((FriendlyCustomTaskRequest,), getFriendlyTimeouts),
|
|
43
45
|
)
|
|
44
46
|
|
|
45
47
|
|
|
@@ -88,6 +90,8 @@ class CapMonsterClient:
|
|
|
88
90
|
ImageToTextRequest,
|
|
89
91
|
FuncaptchaRequest,
|
|
90
92
|
FunCaptchaComplexImageTaskRequest,
|
|
93
|
+
HcaptchaRequest,
|
|
94
|
+
HcaptchaComplexImageTaskRequest,
|
|
91
95
|
GeetestRequest,
|
|
92
96
|
DataDomeCustomTaskRequest,
|
|
93
97
|
TenDiCustomTaskRequest,
|
|
@@ -105,8 +109,8 @@ class CapMonsterClient:
|
|
|
105
109
|
CastleCustomTaskRequest,
|
|
106
110
|
TspdCustomTaskRequest,
|
|
107
111
|
HuntCustomTaskRequest,
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
AlibabaCustomTaskRequest,
|
|
113
|
+
FriendlyCustomTaskRequest],
|
|
110
114
|
) -> Dict[str, str]:
|
|
111
115
|
'''
|
|
112
116
|
Non-blocking method for captcha solving.
|
|
@@ -130,6 +134,8 @@ class CapMonsterClient:
|
|
|
130
134
|
ImageToTextRequest,
|
|
131
135
|
FuncaptchaRequest,
|
|
132
136
|
FunCaptchaComplexImageTaskRequest,
|
|
137
|
+
HcaptchaRequest,
|
|
138
|
+
HcaptchaComplexImageTaskRequest,
|
|
133
139
|
GeetestRequest,
|
|
134
140
|
DataDomeCustomTaskRequest,
|
|
135
141
|
TenDiCustomTaskRequest,
|
|
@@ -144,8 +150,11 @@ class CapMonsterClient:
|
|
|
144
150
|
TemuCustomTaskRequest,
|
|
145
151
|
ProsopoTaskRequest,
|
|
146
152
|
AltchaCustomTaskRequest,
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
CastleCustomTaskRequest,
|
|
154
|
+
TspdCustomTaskRequest,
|
|
155
|
+
HuntCustomTaskRequest,
|
|
156
|
+
AlibabaCustomTaskRequest,
|
|
157
|
+
FriendlyCustomTaskRequest],
|
|
149
158
|
timeouts: GetResultTimeouts,
|
|
150
159
|
) -> Dict[str, str]:
|
|
151
160
|
|
|
@@ -215,4 +224,4 @@ class CapMonsterClient:
|
|
|
215
224
|
raise HTTPException(f'Cannot create task. Status code: {resp.status}.')
|
|
216
225
|
else:
|
|
217
226
|
return await resp.json(content_type=None)
|
|
218
|
-
|
|
227
|
+
|
|
@@ -1,106 +1,87 @@
|
|
|
1
1
|
from typing import Union
|
|
2
2
|
from dataclasses import dataclass
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
@dataclass
|
|
6
5
|
class GetResultTimeouts:
|
|
7
6
|
firstRequestDelay: Union[int, float]
|
|
8
7
|
firstRequestNoCacheDelay: Union[int, float]
|
|
9
|
-
requestsInterval: Union[int, float]
|
|
8
|
+
requestsInterval: Union[int, float]
|
|
10
9
|
timeout: Union[int, float]
|
|
11
10
|
|
|
12
|
-
|
|
13
11
|
def getRecaptchaV2Timeouts() -> GetResultTimeouts:
|
|
14
12
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
15
13
|
|
|
16
|
-
|
|
17
14
|
def getRecaptchaV2EnterpriseTimeouts() -> GetResultTimeouts:
|
|
18
15
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
19
16
|
|
|
20
|
-
|
|
21
17
|
def getRecaptchaV3Timeouts() -> GetResultTimeouts:
|
|
22
18
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
23
19
|
|
|
24
|
-
|
|
25
20
|
def getRecaptchaV3EnterpriseTimeouts() -> GetResultTimeouts:
|
|
26
21
|
return GetResultTimeouts(1, 10, 3, 150)
|
|
27
22
|
|
|
28
|
-
|
|
29
23
|
def getImage2TextTimeouts() -> GetResultTimeouts:
|
|
30
24
|
return GetResultTimeouts(0.35, 0, 0.2, 10)
|
|
31
25
|
|
|
32
|
-
|
|
33
26
|
def getFuncaptchaTimeouts() -> GetResultTimeouts:
|
|
34
27
|
return GetResultTimeouts(1, 10, 1, 80)
|
|
35
28
|
|
|
29
|
+
def getHcaptchaTimeouts() -> GetResultTimeouts:
|
|
30
|
+
return GetResultTimeouts(1, 10, 3, 180)
|
|
36
31
|
|
|
37
32
|
def getGeetestTimeouts() -> GetResultTimeouts:
|
|
38
33
|
return GetResultTimeouts(1, 0, 1, 80)
|
|
39
34
|
|
|
40
|
-
|
|
41
35
|
def getTurnstileTimeouts() -> GetResultTimeouts:
|
|
42
36
|
return GetResultTimeouts(1, 0, 1, 80)
|
|
43
37
|
|
|
44
|
-
|
|
45
38
|
def getDatadomeTimeouts() -> GetResultTimeouts:
|
|
46
|
-
return GetResultTimeouts(1, 0,
|
|
47
|
-
|
|
39
|
+
return GetResultTimeouts(1, 0, 3, 180)
|
|
48
40
|
|
|
49
41
|
def getTenDiTimeouts() -> GetResultTimeouts:
|
|
50
42
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
51
43
|
|
|
52
|
-
|
|
53
44
|
def getBasiliskTimeouts() -> GetResultTimeouts:
|
|
54
45
|
return GetResultTimeouts(1, 10, 3, 100)
|
|
55
46
|
|
|
56
|
-
|
|
57
47
|
def getAmazonWafTimeouts() -> GetResultTimeouts:
|
|
58
48
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
59
49
|
|
|
60
|
-
|
|
61
50
|
def getBinanceTimeouts() -> GetResultTimeouts:
|
|
62
51
|
return GetResultTimeouts(1, 0, 1, 20)
|
|
63
52
|
|
|
64
|
-
|
|
65
53
|
def getImpervaTimeouts() -> GetResultTimeouts:
|
|
66
|
-
return GetResultTimeouts(1, 0, 1,
|
|
67
|
-
|
|
54
|
+
return GetResultTimeouts(1, 0, 1, 15)
|
|
68
55
|
|
|
69
56
|
def getAltchaTimeouts() -> GetResultTimeouts:
|
|
70
57
|
return GetResultTimeouts(1, 0, 1, 50)
|
|
71
58
|
|
|
72
|
-
|
|
73
59
|
def getCastleTimeouts() -> GetResultTimeouts:
|
|
74
60
|
return GetResultTimeouts(1, 0, 1, 60)
|
|
75
61
|
|
|
76
|
-
|
|
77
62
|
def getTspdTimeouts() -> GetResultTimeouts:
|
|
78
63
|
return GetResultTimeouts(1, 0, 1, 60)
|
|
79
64
|
|
|
80
|
-
|
|
81
65
|
def getHuntTimeouts() -> GetResultTimeouts:
|
|
82
|
-
return GetResultTimeouts(1, 0,
|
|
66
|
+
return GetResultTimeouts(1, 0, 3, 180)
|
|
67
|
+
|
|
68
|
+
def getAlibabaTimeouts() -> GetResultTimeouts:
|
|
69
|
+
return GetResultTimeouts(1, 0, 3, 120)
|
|
83
70
|
|
|
71
|
+
def getFriendlyTimeouts() -> GetResultTimeouts:
|
|
72
|
+
return GetResultTimeouts(1, 0, 3, 180)
|
|
84
73
|
|
|
85
74
|
def getCITTimeouts() -> GetResultTimeouts:
|
|
86
75
|
return GetResultTimeouts(0.35, 0, 0.2, 10)
|
|
87
76
|
|
|
77
|
+
def getMTCaptchaTimeouts() -> GetResultTimeouts:
|
|
78
|
+
return GetResultTimeouts(1, 10, 3, 180)
|
|
88
79
|
|
|
89
80
|
def getYidunTimeouts() -> GetResultTimeouts:
|
|
90
81
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
91
82
|
|
|
92
|
-
|
|
93
83
|
def getProsopoTimeouts() -> GetResultTimeouts:
|
|
94
84
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
95
85
|
|
|
96
|
-
|
|
97
86
|
def getTemuTimeouts() -> GetResultTimeouts:
|
|
98
87
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def getFriendlyCaptchaTimeouts() -> GetResultTimeouts:
|
|
102
|
-
return GetResultTimeouts(1, 0, 1, 180)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def getAlibabaTimeouts() -> GetResultTimeouts:
|
|
106
|
-
return GetResultTimeouts(1, 0, 1, 180)
|
{capmonstercloudclient-4.1.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/clientOptions.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from pydantic import BaseModel,
|
|
1
|
+
from pydantic import BaseModel, field_validator, Field
|
|
2
2
|
from .requests import ClientProxyInfo
|
|
3
3
|
from typing import Optional
|
|
4
4
|
|
|
@@ -10,19 +10,22 @@ class ClientOptions(BaseModel):
|
|
|
10
10
|
client_timeout: float = Field(default=20.0)
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
@
|
|
13
|
+
@field_validator('api_key')
|
|
14
|
+
@classmethod
|
|
14
15
|
def validate_api_key(cls, value):
|
|
15
16
|
if not isinstance(value, str):
|
|
16
17
|
raise TypeError(f'Api Key must be <str> type, got {type(value)}')
|
|
17
18
|
return value
|
|
18
19
|
|
|
19
|
-
@
|
|
20
|
+
@field_validator('service_url')
|
|
21
|
+
@classmethod
|
|
20
22
|
def validate_service_url(cls, value):
|
|
21
23
|
if not isinstance(value, str):
|
|
22
24
|
raise TypeError(f'Service url must be <str> type, got {type(value)}')
|
|
23
25
|
return value
|
|
24
26
|
|
|
25
|
-
@
|
|
27
|
+
@field_validator('default_soft_id')
|
|
28
|
+
@classmethod
|
|
26
29
|
def validate_soft_id(cls, value):
|
|
27
30
|
if not isinstance(value, int):
|
|
28
31
|
raise TypeError(f'Soft id must be <int> type, got {type(value)}')
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from typing import Dict, Optional, Union
|
|
2
|
+
from pydantic import Field, field_validator
|
|
3
|
+
|
|
4
|
+
from .CustomTaskRequestBase import CustomTaskRequestBase
|
|
5
|
+
|
|
6
|
+
ALLOWED_METADATA_KEYS = {
|
|
7
|
+
'sceneId', 'prefix', 'userId', 'userUserId', 'verifyType',
|
|
8
|
+
'region', 'UserCertifyId', 'apiGetLib', 'cookieRequired',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
class AlibabaCustomTaskRequest(CustomTaskRequestBase):
|
|
12
|
+
"""
|
|
13
|
+
Represents a payload structure for solving Alibaba custom captcha challenges.
|
|
14
|
+
|
|
15
|
+
Attributes:
|
|
16
|
+
captchaClass: The constant string value identifying the captcha
|
|
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.
|
|
22
|
+
"""
|
|
23
|
+
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.')
|
|
25
|
+
|
|
26
|
+
@field_validator('metadata')
|
|
27
|
+
@classmethod
|
|
28
|
+
def validate_metadata(cls, value):
|
|
29
|
+
if not set(value.keys()).issubset(ALLOWED_METADATA_KEYS):
|
|
30
|
+
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
|
+
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.')
|
|
41
|
+
if value.get('cookieRequired') is not None and not isinstance(value.get('cookieRequired'), bool):
|
|
42
|
+
raise TypeError(f'cookieRequired must be bool.')
|
|
43
|
+
return value
|
|
44
|
+
|
|
45
|
+
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
46
|
+
task = {}
|
|
47
|
+
task['type'] = self.type
|
|
48
|
+
task['class'] = self.captchaClass
|
|
49
|
+
task['websiteURL'] = self.websiteUrl
|
|
50
|
+
task['metadata'] = self.metadata
|
|
51
|
+
if self.proxy:
|
|
52
|
+
task['proxyType'] = self.proxy.proxyType
|
|
53
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
|
54
|
+
task['proxyPort'] = self.proxy.proxyPort
|
|
55
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
|
56
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
|
57
|
+
if self.userAgent is not None:
|
|
58
|
+
task['userAgent'] = self.userAgent
|
|
59
|
+
return task
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from typing import Dict, Union
|
|
2
|
+
from pydantic import Field, field_validator
|
|
3
|
+
|
|
4
|
+
from .CustomTaskRequestBase import CustomTaskRequestBase
|
|
5
|
+
|
|
6
|
+
class AltchaCustomTaskRequest(CustomTaskRequestBase):
|
|
7
|
+
"""
|
|
8
|
+
Represents a payload structure for solving Altcha proof-of-work
|
|
9
|
+
captcha challenges via a custom module.
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
captchaClass: The class (subtype) identifier of the custom
|
|
13
|
+
module, constant "altcha" for this task.
|
|
14
|
+
websiteKey: The site key associated with the Altcha challenge
|
|
15
|
+
on the webpage. An empty string is allowed for this task.
|
|
16
|
+
metadata: A dictionary containing the Altcha challenge parameters
|
|
17
|
+
(challenge, iterations, salt, signature) extracted from the
|
|
18
|
+
webpage.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
captchaClass: str = Field(default='altcha', description='Class (subtype) identifier of the custom module, constant "altcha".')
|
|
22
|
+
websiteKey: str = Field(description='Site key associated with the Altcha challenge on the webpage. An empty string is allowed for this task.')
|
|
23
|
+
metadata: Dict[str, str] = Field(description='Altcha challenge parameters: challenge, iterations, salt, and signature.')
|
|
24
|
+
|
|
25
|
+
@field_validator('metadata')
|
|
26
|
+
@classmethod
|
|
27
|
+
def validate_metadata(cls, value):
|
|
28
|
+
for key in ['challenge', 'iterations', 'salt', 'signature']:
|
|
29
|
+
if value.get(key) is None:
|
|
30
|
+
raise TypeError(f'{key} must be defined inside metadata.')
|
|
31
|
+
else:
|
|
32
|
+
if not isinstance(value.get(key), str):
|
|
33
|
+
raise TypeError(f'{key} must be str.')
|
|
34
|
+
return value
|
|
35
|
+
|
|
36
|
+
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
37
|
+
task = {}
|
|
38
|
+
task['type'] = self.type
|
|
39
|
+
task['class'] = self.captchaClass
|
|
40
|
+
task['websiteURL'] = self.websiteUrl
|
|
41
|
+
task['websiteKey'] = self.websiteKey
|
|
42
|
+
task['metadata'] = self.metadata
|
|
43
|
+
if self.proxy:
|
|
44
|
+
task['proxyType'] = self.proxy.proxyType
|
|
45
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
|
46
|
+
task['proxyPort'] = self.proxy.proxyPort
|
|
47
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
|
48
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
|
49
|
+
if self.userAgent is not None:
|
|
50
|
+
task['userAgent'] = self.userAgent
|
|
51
|
+
return task
|