capmonstercloudclient 4.0.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.0.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/CapMonsterCloudClient.py +12 -3
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/GetResultTimeouts.py +12 -3
- {capmonstercloudclient-4.0.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.0.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.0.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.0.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.0.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requests/HcaptchaComplexImageTask.py +38 -13
- 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.0.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.0.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requests/RecognitionComplexImageTaskRequest.py +23 -8
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requests/TemuCustomTaskRequest.py +19 -6
- {capmonstercloudclient-4.0.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.0.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requests/__init__.py +5 -1
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/baseRequest.py +23 -0
- capmonstercloudclient-4.2.0/capmonstercloud_client/requests/baseRequestWithProxy.py +16 -0
- {capmonstercloudclient-4.0.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.0.0 → capmonstercloudclient-4.2.0}/capmonstercloudclient.egg-info/SOURCES.txt +2 -0
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/capmonstercloudclient.egg-info/requires.txt +16 -0
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/requirements.txt +16 -1
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/setup.py +4 -0
- capmonstercloudclient-4.0.0/PKG-INFO +0 -116
- capmonstercloudclient-4.0.0/README.md +0 -50
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/AltchaCustomTaskRequest.py +0 -36
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/AmazonWafRequest.py +0 -35
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/BinanceTaskRequest.py +0 -29
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/ComplexImageTaskBase.py +0 -11
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/CustomTaskRequestBase.py +0 -10
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/DataDomeCustomTaskRequest.py +0 -46
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/FuncaptchaRequest.py +0 -32
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/GeetestRequest.py +0 -53
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/HcaptchaRequest.py +0 -39
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/HuntCustomTaskRequest.py +0 -41
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/ImageToTextRequest.py +0 -68
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/ImpervaCustomTaskRequest.py +0 -46
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/MTCaptchaRequest.py +0 -32
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/ProsopoTaskRequest.py +0 -23
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/RecaptchaV2EnterpiseRequest.py +0 -37
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/RecaptchaV2Request.py +0 -41
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/RecaptchaV3EnterpriseRequest.py +0 -22
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/RecaptchaV3ProxylessRequest.py +0 -30
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/TspdCustomTaskRequest.py +0 -44
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/TurnstileRequest.py +0 -81
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/YidunRequest.py +0 -41
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/baseRequest.py +0 -11
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/baseRequestWithProxy.py +0 -7
- capmonstercloudclient-4.0.0/capmonstercloud_client/requests/proxy_info.py +0 -41
- capmonstercloudclient-4.0.0/capmonstercloud_client/version.txt +0 -1
- capmonstercloudclient-4.0.0/capmonstercloudclient.egg-info/PKG-INFO +0 -116
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/LICENSE +0 -0
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/MANIFEST.in +0 -0
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/__init__.py +0 -0
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/captchaResult.py +0 -0
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/exceptions.py +0 -0
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/requestController.py +0 -0
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/capmonstercloud_client/utils.py +0 -0
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/capmonstercloudclient.egg-info/dependency_links.txt +0 -0
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/capmonstercloudclient.egg-info/top_level.txt +0 -0
- {capmonstercloudclient-4.0.0 → capmonstercloudclient-4.2.0}/pyproject.toml +0 -0
- {capmonstercloudclient-4.0.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!**
|
|
@@ -32,7 +32,7 @@ _instance_config = (
|
|
|
32
32
|
((BinanceTaskRequest,), getBinanceTimeouts),
|
|
33
33
|
((ImpervaCustomTaskRequest,), getImpervaTimeouts),
|
|
34
34
|
((RecognitionComplexImageTaskRequest,), getCITTimeouts),
|
|
35
|
-
((MTCaptchaRequest,),
|
|
35
|
+
((MTCaptchaRequest,), getMTCaptchaTimeouts),
|
|
36
36
|
((YidunRequest,), getYidunTimeouts),
|
|
37
37
|
((TemuCustomTaskRequest,), getTemuTimeouts),
|
|
38
38
|
((ProsopoTaskRequest,), getProsopoTimeouts),
|
|
@@ -40,6 +40,8 @@ _instance_config = (
|
|
|
40
40
|
((CastleCustomTaskRequest,), getCastleTimeouts),
|
|
41
41
|
((TspdCustomTaskRequest,), getTspdTimeouts),
|
|
42
42
|
((HuntCustomTaskRequest,), getHuntTimeouts),
|
|
43
|
+
((AlibabaCustomTaskRequest,), getAlibabaTimeouts),
|
|
44
|
+
((FriendlyCustomTaskRequest,), getFriendlyTimeouts),
|
|
43
45
|
)
|
|
44
46
|
|
|
45
47
|
|
|
@@ -106,7 +108,9 @@ class CapMonsterClient:
|
|
|
106
108
|
AltchaCustomTaskRequest,
|
|
107
109
|
CastleCustomTaskRequest,
|
|
108
110
|
TspdCustomTaskRequest,
|
|
109
|
-
HuntCustomTaskRequest
|
|
111
|
+
HuntCustomTaskRequest,
|
|
112
|
+
AlibabaCustomTaskRequest,
|
|
113
|
+
FriendlyCustomTaskRequest],
|
|
110
114
|
) -> Dict[str, str]:
|
|
111
115
|
'''
|
|
112
116
|
Non-blocking method for captcha solving.
|
|
@@ -145,7 +149,12 @@ class CapMonsterClient:
|
|
|
145
149
|
YidunRequest,
|
|
146
150
|
TemuCustomTaskRequest,
|
|
147
151
|
ProsopoTaskRequest,
|
|
148
|
-
AltchaCustomTaskRequest
|
|
152
|
+
AltchaCustomTaskRequest,
|
|
153
|
+
CastleCustomTaskRequest,
|
|
154
|
+
TspdCustomTaskRequest,
|
|
155
|
+
HuntCustomTaskRequest,
|
|
156
|
+
AlibabaCustomTaskRequest,
|
|
157
|
+
FriendlyCustomTaskRequest],
|
|
149
158
|
timeouts: GetResultTimeouts,
|
|
150
159
|
) -> Dict[str, str]:
|
|
151
160
|
|
|
@@ -36,7 +36,7 @@ def getTurnstileTimeouts() -> GetResultTimeouts:
|
|
|
36
36
|
return GetResultTimeouts(1, 0, 1, 80)
|
|
37
37
|
|
|
38
38
|
def getDatadomeTimeouts() -> GetResultTimeouts:
|
|
39
|
-
return GetResultTimeouts(1, 0,
|
|
39
|
+
return GetResultTimeouts(1, 0, 3, 180)
|
|
40
40
|
|
|
41
41
|
def getTenDiTimeouts() -> GetResultTimeouts:
|
|
42
42
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
@@ -51,7 +51,7 @@ def getBinanceTimeouts() -> GetResultTimeouts:
|
|
|
51
51
|
return GetResultTimeouts(1, 0, 1, 20)
|
|
52
52
|
|
|
53
53
|
def getImpervaTimeouts() -> GetResultTimeouts:
|
|
54
|
-
return GetResultTimeouts(1, 0, 1,
|
|
54
|
+
return GetResultTimeouts(1, 0, 1, 15)
|
|
55
55
|
|
|
56
56
|
def getAltchaTimeouts() -> GetResultTimeouts:
|
|
57
57
|
return GetResultTimeouts(1, 0, 1, 50)
|
|
@@ -63,11 +63,20 @@ def getTspdTimeouts() -> GetResultTimeouts:
|
|
|
63
63
|
return GetResultTimeouts(1, 0, 1, 60)
|
|
64
64
|
|
|
65
65
|
def getHuntTimeouts() -> GetResultTimeouts:
|
|
66
|
-
return GetResultTimeouts(1, 0,
|
|
66
|
+
return GetResultTimeouts(1, 0, 3, 180)
|
|
67
|
+
|
|
68
|
+
def getAlibabaTimeouts() -> GetResultTimeouts:
|
|
69
|
+
return GetResultTimeouts(1, 0, 3, 120)
|
|
70
|
+
|
|
71
|
+
def getFriendlyTimeouts() -> GetResultTimeouts:
|
|
72
|
+
return GetResultTimeouts(1, 0, 3, 180)
|
|
67
73
|
|
|
68
74
|
def getCITTimeouts() -> GetResultTimeouts:
|
|
69
75
|
return GetResultTimeouts(0.35, 0, 0.2, 10)
|
|
70
76
|
|
|
77
|
+
def getMTCaptchaTimeouts() -> GetResultTimeouts:
|
|
78
|
+
return GetResultTimeouts(1, 10, 3, 180)
|
|
79
|
+
|
|
71
80
|
def getYidunTimeouts() -> GetResultTimeouts:
|
|
72
81
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
73
82
|
|
{capmonstercloudclient-4.0.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
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
from typing import Dict, Union, Optional
|
|
2
|
+
from pydantic import Field, model_validator
|
|
3
|
+
|
|
4
|
+
from .baseRequestWithProxy import BaseRequestWithProxy
|
|
5
|
+
|
|
6
|
+
class AmazonWafRequest(BaseRequestWithProxy):
|
|
7
|
+
"""
|
|
8
|
+
Represents a payload structure for solving Amazon AWS WAF captcha challenges.
|
|
9
|
+
|
|
10
|
+
The live API accepts three mutually exclusive parameter sets:
|
|
11
|
+
Option 1 (visible captcha): websiteUrl, websiteKey, captchaScript
|
|
12
|
+
required; challengeScript/context/iv must not be set.
|
|
13
|
+
Option 2 (challenge + captcha): websiteUrl, challengeScript, websiteKey,
|
|
14
|
+
context, iv required; captchaScript optional.
|
|
15
|
+
Option 3 (invisible/challenge-only): websiteUrl, challengeScript
|
|
16
|
+
required; context and iv must be empty strings; websiteKey and
|
|
17
|
+
captchaScript must not be set.
|
|
18
|
+
|
|
19
|
+
Attributes:
|
|
20
|
+
type: The constant string value identifying the task type as "AmazonTask".
|
|
21
|
+
websiteUrl: The URL of the webpage where the Amazon AWS WAF challenge
|
|
22
|
+
is presented.
|
|
23
|
+
challengeScript: Link to challenge.js served by AWS WAF on the target
|
|
24
|
+
page. Required for Options 2 and 3; must not be set for Option 1.
|
|
25
|
+
captchaScript: Link to captcha.js / jsapi.js served by AWS WAF on the
|
|
26
|
+
target page. Required for Option 1, optional for Option 2, must
|
|
27
|
+
not be set for Option 3.
|
|
28
|
+
websiteKey: The site key associated with the AWS WAF challenge.
|
|
29
|
+
Required for Options 1 and 2; must not be set for Option 3.
|
|
30
|
+
context: The context token provided by AWS WAF, used to correlate
|
|
31
|
+
the challenge with a specific session. Required for Option 2;
|
|
32
|
+
must be an empty string for Option 3; must not be set for Option 1.
|
|
33
|
+
iv: The initialization vector value provided by AWS WAF as part
|
|
34
|
+
of the challenge payload. Required for Option 2; must be an
|
|
35
|
+
empty string for Option 3; must not be set for Option 1.
|
|
36
|
+
cookieSolution: When set to True, requests the solution to be
|
|
37
|
+
returned as a ready-to-use cookie instead of a token.
|
|
38
|
+
userAgent: Browser User-Agent to emulate. Only used for Option 1.
|
|
39
|
+
Pass only a current Windows OS UA.
|
|
40
|
+
"""
|
|
41
|
+
type: str = Field(default='AmazonTask', description='The constant string value identifying the task type as "AmazonTask".')
|
|
42
|
+
websiteUrl: str = Field(..., description='The URL of the webpage where the Amazon AWS WAF challenge is presented.')
|
|
43
|
+
challengeScript: Optional[str] = Field(default=None, description='Link to challenge.js served by AWS WAF on the target page. Required for Options 2 and 3; must not be set for Option 1.')
|
|
44
|
+
captchaScript: Optional[str] = Field(default=None, description='Link to captcha.js / jsapi.js served by AWS WAF on the target page. Required for Option 1, optional for Option 2, must not be set for Option 3.')
|
|
45
|
+
websiteKey: Optional[str] = Field(default=None, description='The site key associated with the AWS WAF challenge. Required for Options 1 and 2; must not be set for Option 3.')
|
|
46
|
+
context: Optional[str] = Field(default=None, description='The context token provided by AWS WAF, used to correlate the challenge with a specific session. Required for Option 2; must be an empty string for Option 3; must not be set for Option 1.')
|
|
47
|
+
iv: Optional[str] = Field(default=None, description='The initialization vector value provided by AWS WAF as part of the challenge payload. Required for Option 2; must be an empty string for Option 3; must not be set for Option 1.')
|
|
48
|
+
cookieSolution: Optional[bool] = Field(default=None, description='When set to True, requests the solution to be returned as a ready-to-use cookie instead of a token.')
|
|
49
|
+
userAgent: Optional[str] = Field(default=None, description='Browser User-Agent to emulate. Only used for Option 1. Pass only a current Windows OS UA.')
|
|
50
|
+
|
|
51
|
+
@model_validator(mode='after')
|
|
52
|
+
def validate_amazon_waf_variant(self):
|
|
53
|
+
if self.challengeScript is None:
|
|
54
|
+
# Option 1: visible captcha, no challenge.js involved.
|
|
55
|
+
if self.websiteKey is None or self.captchaScript is None:
|
|
56
|
+
raise ValueError('"websiteKey" and "captchaScript" must be filled '
|
|
57
|
+
'when "challengeScript" is not provided (Option 1).')
|
|
58
|
+
if self.context is not None or self.iv is not None:
|
|
59
|
+
raise ValueError('"context" and "iv" are not used when "challengeScript" is not provided (Option 1).')
|
|
60
|
+
elif self.websiteKey is None and self.captchaScript is None:
|
|
61
|
+
# Option 3: invisible/challenge-only captcha.
|
|
62
|
+
if self.context != '' or self.iv != '':
|
|
63
|
+
raise ValueError('"context" and "iv" must be empty strings '
|
|
64
|
+
'when only "challengeScript" is provided (Option 3).')
|
|
65
|
+
else:
|
|
66
|
+
# Option 2: challenge + captcha.
|
|
67
|
+
if self.websiteKey is None or self.context is None or self.iv is None:
|
|
68
|
+
raise ValueError('"websiteKey", "context" and "iv" must be filled '
|
|
69
|
+
'when "challengeScript" is provided together with "websiteKey" (Option 2).')
|
|
70
|
+
return self
|
|
71
|
+
|
|
72
|
+
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
73
|
+
task = {}
|
|
74
|
+
task['type'] = self.type
|
|
75
|
+
task['websiteURL'] = self.websiteUrl
|
|
76
|
+
if self.challengeScript is not None:
|
|
77
|
+
task['challengeScript'] = self.challengeScript
|
|
78
|
+
if self.captchaScript is not None:
|
|
79
|
+
task['captchaScript'] = self.captchaScript
|
|
80
|
+
if self.websiteKey is not None:
|
|
81
|
+
task['websiteKey'] = self.websiteKey
|
|
82
|
+
if self.context is not None:
|
|
83
|
+
task['context'] = self.context
|
|
84
|
+
if self.iv is not None:
|
|
85
|
+
task['iv'] = self.iv
|
|
86
|
+
|
|
87
|
+
if self.proxy:
|
|
88
|
+
task['proxyType'] = self.proxy.proxyType
|
|
89
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
|
90
|
+
task['proxyPort'] = self.proxy.proxyPort
|
|
91
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
|
92
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
|
93
|
+
|
|
94
|
+
if self.cookieSolution is not None:
|
|
95
|
+
task['cookieSolution'] = self.cookieSolution
|
|
96
|
+
if self.userAgent is not None:
|
|
97
|
+
task['userAgent'] = self.userAgent
|
|
98
|
+
return task
|
|
@@ -4,8 +4,19 @@ from pydantic import Field
|
|
|
4
4
|
from .CustomTaskRequestBase import CustomTaskRequestBase
|
|
5
5
|
|
|
6
6
|
class BasiliskCustomTaskRequest(CustomTaskRequestBase):
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
"""
|
|
8
|
+
Represents a payload structure for solving Basilisk custom captcha
|
|
9
|
+
challenges.
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
captchaClass: The class (subtype) identifier of the custom module,
|
|
13
|
+
fixed to "Basilisk" for this task type.
|
|
14
|
+
websiteKey: The site key associated with the Basilisk captcha on
|
|
15
|
+
the webpage.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
captchaClass: str = Field(default='Basilisk', description='Class (subtype) identifier of the custom module, fixed to "Basilisk".')
|
|
19
|
+
websiteKey: str = Field(..., description='Site key associated with the Basilisk captcha on the webpage.')
|
|
9
20
|
|
|
10
21
|
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
11
22
|
task = {}
|