capmonstercloudclient 3.4.0__tar.gz → 4.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/PKG-INFO +60 -36
- capmonstercloudclient-4.1.0/README.md +75 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/CapMonsterCloudClient.py +30 -26
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/GetResultTimeouts.py +40 -3
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/AlibabaCustomTaskRequest.py +42 -0
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/CastleCustomTaskRequest.py +42 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/DataDomeCustomTaskRequest.py +16 -12
- capmonstercloudclient-3.4.0/capmonstercloud_client/requests/TenDiCustomTaskRequest.py → capmonstercloudclient-4.1.0/capmonstercloud_client/requests/FriendlyCaptchaRequest.py +15 -4
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/HuntCustomTaskRequest.py +41 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/RecaptchaV2EnterpiseRequest.py +7 -1
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/RecaptchaV2Request.py +6 -2
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/RecaptchaV3ProxylessRequest.py +4 -4
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/RecognitionComplexImageTaskRequest.py +2 -2
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/TenDiCustomTaskRequest.py +36 -0
- capmonstercloudclient-4.1.0/capmonstercloud_client/requests/TspdCustomTaskRequest.py +44 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/YidunRequest.py +15 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/__init__.py +12 -5
- capmonstercloudclient-4.1.0/capmonstercloud_client/version.txt +1 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloudclient.egg-info/PKG-INFO +60 -36
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloudclient.egg-info/SOURCES.txt +5 -2
- capmonstercloudclient-4.1.0/pyproject.toml +3 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/setup.py +5 -6
- capmonstercloudclient-3.4.0/README.md +0 -50
- capmonstercloudclient-3.4.0/capmonstercloud_client/requests/HcaptchaComplexImageTask.py +0 -96
- capmonstercloudclient-3.4.0/capmonstercloud_client/requests/HcaptchaRequest.py +0 -39
- capmonstercloudclient-3.4.0/capmonstercloud_client/version.txt +0 -1
- capmonstercloudclient-3.4.0/pyproject.toml +0 -3
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/LICENSE +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/MANIFEST.in +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/__init__.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/captchaResult.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/clientOptions.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/exceptions.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requestController.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/AltchaCustomTaskRequest.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/AmazonWafRequest.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/BasiliskCustomTaskRequest.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/BinanceTaskRequest.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/ComplexImageTaskBase.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/CustomTaskRequestBase.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/FuncaptchaComplexImageTask.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/FuncaptchaRequest.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/GeetestRequest.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/ImageToTextRequest.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/ImpervaCustomTaskRequest.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/MTCaptchaRequest.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/ProsopoTaskRequest.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/RecaptchaComplexImageTask.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/RecaptchaV3EnterpriseRequest.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/TemuCustomTaskRequest.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/TurnstileRequest.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/baseRequest.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/baseRequestWithProxy.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/enums.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/requests/proxy_info.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloud_client/utils.py +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloudclient.egg-info/dependency_links.txt +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloudclient.egg-info/requires.txt +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/capmonstercloudclient.egg-info/top_level.txt +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/requirements.txt +0 -0
- {capmonstercloudclient-3.4.0 → capmonstercloudclient-4.1.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: capmonstercloudclient
|
|
3
|
-
Version:
|
|
3
|
+
Version: 4.1.0
|
|
4
4
|
Summary: Official CapMonsterCloud Client: https://capmonster.cloud/
|
|
5
5
|
Home-page: https://github.com/ZennoLab/capmonstercloud-client-python
|
|
6
6
|
Author: Andrey Ilyin
|
|
@@ -9,7 +9,6 @@ License: AGPL-3.0
|
|
|
9
9
|
Keywords: captcha
|
|
10
10
|
recaptcha
|
|
11
11
|
geetest
|
|
12
|
-
hcaptcha
|
|
13
12
|
funcaptcha
|
|
14
13
|
python3
|
|
15
14
|
python-library
|
|
@@ -64,53 +63,78 @@ Dynamic: requires-dist
|
|
|
64
63
|
Dynamic: requires-python
|
|
65
64
|
Dynamic: summary
|
|
66
65
|
|
|
67
|
-
#
|
|
66
|
+
# CapMonster Cloud Python SDK
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
[](https://pypi.org/project/capmonstercloudclient/)
|
|
69
|
+
|
|
70
|
+
Official Python SDK for the CapMonster Cloud API.
|
|
71
|
+
Use this package when you want to create tasks and retrieve solutions from Python applications or scripts.
|
|
72
|
+
|
|
73
|
+
## Links
|
|
74
|
+
|
|
75
|
+
- Package: [capmonstercloudclient on PyPI](https://pypi.org/project/capmonstercloudclient/)
|
|
76
|
+
- Documentation: [docs.capmonster.cloud](https://docs.capmonster.cloud/)
|
|
77
|
+
- Dashboard / API key: [dash.capmonster.cloud](https://dash.capmonster.cloud/)
|
|
70
78
|
|
|
71
79
|
## Installation
|
|
72
80
|
|
|
73
|
-
|
|
81
|
+
```bash
|
|
82
|
+
python3 -m pip install capmonstercloudclient
|
|
83
|
+
```
|
|
74
84
|
|
|
75
|
-
|
|
85
|
+
Need to test before depositing? Contact support and we’ll add trial credits to your account.
|
|
76
86
|
|
|
77
|
-
|
|
78
|
-
import asyncio
|
|
87
|
+
## Minimal async example
|
|
79
88
|
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
```python
|
|
90
|
+
import asyncio
|
|
82
91
|
|
|
83
|
-
|
|
84
|
-
|
|
92
|
+
from capmonstercloudclient import CapMonsterClient, ClientOptions
|
|
93
|
+
from capmonstercloudclient.requests import RecaptchaV2Request
|
|
85
94
|
|
|
86
|
-
|
|
87
|
-
|
|
95
|
+
client_options = ClientOptions(api_key="<YOUR_API_KEY>")
|
|
96
|
+
cap_monster_client = CapMonsterClient(options=client_options)
|
|
88
97
|
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
recaptcha2request = RecaptchaV2Request(
|
|
99
|
+
websiteUrl="https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=high",
|
|
100
|
+
websiteKey="6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd",
|
|
101
|
+
)
|
|
91
102
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
***
|
|
103
|
+
async def solve_captcha():
|
|
104
|
+
return await cap_monster_client.solve_captcha(recaptcha2request)
|
|
95
105
|
|
|
96
|
-
|
|
106
|
+
response = asyncio.run(solve_captcha())
|
|
107
|
+
print(response)
|
|
108
|
+
```
|
|
97
109
|
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
- [
|
|
103
|
-
- [
|
|
104
|
-
- [RecaptchaV2EnterpriseProxylessRequest](https://zenno.link/doc-recaptcha2e-en)
|
|
105
|
-
- [RecaptchaV2EnterpriseRequest](https://zenno.link/doc-recaptcha2e-proxy-en)
|
|
106
|
-
- [TurnstileProxylessRequest](https://zenno.link/doc-turnstile-en)
|
|
107
|
-
- [TurnstileRequest](https://zenno.link/doc-turnstile-proxy-en)
|
|
108
|
-
- [RecaptchaComplexImageTaskRequest](https://zenno.link/doc-complextask-rc-en)
|
|
109
|
-
- [DataDomeCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/datadome)
|
|
110
|
-
- [TenDiCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/tendi)
|
|
111
|
-
- [BasiliskCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/Basilisk-task)
|
|
110
|
+
Supported task families include reCAPTCHA, GeeTest, Turnstile, image-to-text, and additional task types documented in the public docs.
|
|
111
|
+
|
|
112
|
+
Supported request classes:
|
|
113
|
+
|
|
114
|
+
- [AltchaCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/altcha-task)
|
|
115
|
+
- [AlibabaCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/alibaba-task)
|
|
112
116
|
- [AmazonWafRequest](https://docs.capmonster.cloud/docs/captchas/amazon-task)
|
|
117
|
+
- [BasiliskCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/Basilisk-task)
|
|
113
118
|
- [BinanceTaskRequest](https://docs.capmonster.cloud/docs/captchas/binance)
|
|
114
|
-
- [
|
|
119
|
+
- [CastleCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/castle-task)
|
|
120
|
+
- [DataDomeCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/datadome)
|
|
121
|
+
- [FriendlyCaptchaRequest](https://docs.capmonster.cloud/docs/captchas/friendly-task)
|
|
122
|
+
- [FuncaptchaRequest](https://docs.capmonster.cloud/docs/captchas/funcaptcha-task)
|
|
123
|
+
- [FunCaptchaComplexImageTaskRequest](https://docs.capmonster.cloud/docs/captchas/ComplexImageTask-Recognition)
|
|
124
|
+
- [GeetestRequest](https://docs.capmonster.cloud/docs/captchas/geetest-task)
|
|
125
|
+
- [HuntCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/hunt-task)
|
|
126
|
+
- [ImageToTextRequest](https://docs.capmonster.cloud/docs/captchas/image-to-text)
|
|
115
127
|
- [ImpervaCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/incapsula)
|
|
116
|
-
- [
|
|
128
|
+
- [MTCaptchaRequest](https://docs.capmonster.cloud/docs/captchas/mtcaptcha-task)
|
|
129
|
+
- [ProsopoTaskRequest](https://docs.capmonster.cloud/docs/captchas/prosopo-task)
|
|
130
|
+
- [RecognitionComplexImageTaskRequest](https://docs.capmonster.cloud/docs/captchas/ComplexImageTask-Recognition)
|
|
131
|
+
- [RecaptchaComplexImageTaskRequest](https://docs.capmonster.cloud/docs/captchas/recaptcha-click)
|
|
132
|
+
- [RecaptchaV2EnterpriseRequest](https://docs.capmonster.cloud/docs/captchas/recaptcha-v2-enterprise-task)
|
|
133
|
+
- [RecaptchaV2Request](https://docs.capmonster.cloud/docs/captchas/no-captcha-task)
|
|
134
|
+
- [RecaptchaV3EnterpriseRequest](https://docs.capmonster.cloud/docs/captchas/recaptcha-v3-enterprise-task)
|
|
135
|
+
- [RecaptchaV3ProxylessRequest](https://docs.capmonster.cloud/docs/captchas/recaptcha-v3-task)
|
|
136
|
+
- [TemuCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/temu-task)
|
|
137
|
+
- [TenDiCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/tendi)
|
|
138
|
+
- [TspdCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/tspd-task)
|
|
139
|
+
- [TurnstileRequest](https://docs.capmonster.cloud/docs/captchas/turnstile-task)
|
|
140
|
+
- [YidunRequest](https://docs.capmonster.cloud/docs/captchas/yidun-task)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# CapMonster Cloud Python SDK
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/capmonstercloudclient/)
|
|
4
|
+
|
|
5
|
+
Official Python SDK for the CapMonster Cloud API.
|
|
6
|
+
Use this package when you want to create tasks and retrieve solutions from Python applications or scripts.
|
|
7
|
+
|
|
8
|
+
## Links
|
|
9
|
+
|
|
10
|
+
- Package: [capmonstercloudclient on PyPI](https://pypi.org/project/capmonstercloudclient/)
|
|
11
|
+
- Documentation: [docs.capmonster.cloud](https://docs.capmonster.cloud/)
|
|
12
|
+
- Dashboard / API key: [dash.capmonster.cloud](https://dash.capmonster.cloud/)
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
python3 -m pip install capmonstercloudclient
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Need to test before depositing? Contact support and we’ll add trial credits to your account.
|
|
21
|
+
|
|
22
|
+
## Minimal async example
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
import asyncio
|
|
26
|
+
|
|
27
|
+
from capmonstercloudclient import CapMonsterClient, ClientOptions
|
|
28
|
+
from capmonstercloudclient.requests import RecaptchaV2Request
|
|
29
|
+
|
|
30
|
+
client_options = ClientOptions(api_key="<YOUR_API_KEY>")
|
|
31
|
+
cap_monster_client = CapMonsterClient(options=client_options)
|
|
32
|
+
|
|
33
|
+
recaptcha2request = RecaptchaV2Request(
|
|
34
|
+
websiteUrl="https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=high",
|
|
35
|
+
websiteKey="6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd",
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
async def solve_captcha():
|
|
39
|
+
return await cap_monster_client.solve_captcha(recaptcha2request)
|
|
40
|
+
|
|
41
|
+
response = asyncio.run(solve_captcha())
|
|
42
|
+
print(response)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Supported task families include reCAPTCHA, GeeTest, Turnstile, image-to-text, and additional task types documented in the public docs.
|
|
46
|
+
|
|
47
|
+
Supported request classes:
|
|
48
|
+
|
|
49
|
+
- [AltchaCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/altcha-task)
|
|
50
|
+
- [AlibabaCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/alibaba-task)
|
|
51
|
+
- [AmazonWafRequest](https://docs.capmonster.cloud/docs/captchas/amazon-task)
|
|
52
|
+
- [BasiliskCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/Basilisk-task)
|
|
53
|
+
- [BinanceTaskRequest](https://docs.capmonster.cloud/docs/captchas/binance)
|
|
54
|
+
- [CastleCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/castle-task)
|
|
55
|
+
- [DataDomeCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/datadome)
|
|
56
|
+
- [FriendlyCaptchaRequest](https://docs.capmonster.cloud/docs/captchas/friendly-task)
|
|
57
|
+
- [FuncaptchaRequest](https://docs.capmonster.cloud/docs/captchas/funcaptcha-task)
|
|
58
|
+
- [FunCaptchaComplexImageTaskRequest](https://docs.capmonster.cloud/docs/captchas/ComplexImageTask-Recognition)
|
|
59
|
+
- [GeetestRequest](https://docs.capmonster.cloud/docs/captchas/geetest-task)
|
|
60
|
+
- [HuntCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/hunt-task)
|
|
61
|
+
- [ImageToTextRequest](https://docs.capmonster.cloud/docs/captchas/image-to-text)
|
|
62
|
+
- [ImpervaCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/incapsula)
|
|
63
|
+
- [MTCaptchaRequest](https://docs.capmonster.cloud/docs/captchas/mtcaptcha-task)
|
|
64
|
+
- [ProsopoTaskRequest](https://docs.capmonster.cloud/docs/captchas/prosopo-task)
|
|
65
|
+
- [RecognitionComplexImageTaskRequest](https://docs.capmonster.cloud/docs/captchas/ComplexImageTask-Recognition)
|
|
66
|
+
- [RecaptchaComplexImageTaskRequest](https://docs.capmonster.cloud/docs/captchas/recaptcha-click)
|
|
67
|
+
- [RecaptchaV2EnterpriseRequest](https://docs.capmonster.cloud/docs/captchas/recaptcha-v2-enterprise-task)
|
|
68
|
+
- [RecaptchaV2Request](https://docs.capmonster.cloud/docs/captchas/no-captcha-task)
|
|
69
|
+
- [RecaptchaV3EnterpriseRequest](https://docs.capmonster.cloud/docs/captchas/recaptcha-v3-enterprise-task)
|
|
70
|
+
- [RecaptchaV3ProxylessRequest](https://docs.capmonster.cloud/docs/captchas/recaptcha-v3-task)
|
|
71
|
+
- [TemuCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/temu-task)
|
|
72
|
+
- [TenDiCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/tendi)
|
|
73
|
+
- [TspdCustomTaskRequest](https://docs.capmonster.cloud/docs/captchas/tspd-task)
|
|
74
|
+
- [TurnstileRequest](https://docs.capmonster.cloud/docs/captchas/turnstile-task)
|
|
75
|
+
- [YidunRequest](https://docs.capmonster.cloud/docs/captchas/yidun-task)
|
|
@@ -16,27 +16,30 @@ from .utils import parseVersion
|
|
|
16
16
|
_instance_config = (
|
|
17
17
|
((RecaptchaV2Request,), getRecaptchaV2Timeouts),
|
|
18
18
|
((RecaptchaV2EnterpriseRequest,), getRecaptchaV2EnterpriseTimeouts),
|
|
19
|
-
((RecaptchaV3ProxylessRequest), getRecaptchaV3Timeouts),
|
|
20
|
-
((RecaptchaV3EnterpriseRequest), getRecaptchaV3Timeouts),
|
|
21
|
-
((ImageToTextRequest), getImage2TextTimeouts),
|
|
19
|
+
((RecaptchaV3ProxylessRequest,), getRecaptchaV3Timeouts),
|
|
20
|
+
((RecaptchaV3EnterpriseRequest,), getRecaptchaV3Timeouts),
|
|
21
|
+
((ImageToTextRequest,), getImage2TextTimeouts),
|
|
22
22
|
((FuncaptchaRequest,), getFuncaptchaTimeouts),
|
|
23
|
-
((HcaptchaRequest,), getHcaptchaTimeouts),
|
|
24
23
|
((GeetestRequest,), getGeetestTimeouts),
|
|
25
24
|
((TurnstileRequest,), getTurnstileTimeouts),
|
|
26
|
-
((RecaptchaComplexImageTaskRequest,
|
|
27
|
-
FunCaptchaComplexImageTaskRequest), getImage2TextTimeouts),
|
|
25
|
+
((RecaptchaComplexImageTaskRequest, FunCaptchaComplexImageTaskRequest), getImage2TextTimeouts),
|
|
28
26
|
((DataDomeCustomTaskRequest,), getDatadomeTimeouts),
|
|
29
27
|
((TenDiCustomTaskRequest,), getTenDiTimeouts),
|
|
30
28
|
((BasiliskCustomTaskRequest,), getBasiliskTimeouts),
|
|
31
29
|
((AmazonWafRequest,), getAmazonWafTimeouts),
|
|
32
30
|
((BinanceTaskRequest,), getBinanceTimeouts),
|
|
33
31
|
((ImpervaCustomTaskRequest,), getImpervaTimeouts),
|
|
34
|
-
((RecognitionComplexImageTaskRequest), getCITTimeouts),
|
|
35
|
-
((MTCaptchaRequest), getImage2TextTimeouts),
|
|
36
|
-
((YidunRequest), getYidunTimeouts),
|
|
37
|
-
((TemuCustomTaskRequest), getTemuTimeouts),
|
|
38
|
-
((ProsopoTaskRequest), getProsopoTimeouts),
|
|
39
|
-
((AltchaCustomTaskRequest), getAltchaTimeouts),
|
|
32
|
+
((RecognitionComplexImageTaskRequest,), getCITTimeouts),
|
|
33
|
+
((MTCaptchaRequest,), getImage2TextTimeouts),
|
|
34
|
+
((YidunRequest,), getYidunTimeouts),
|
|
35
|
+
((TemuCustomTaskRequest,), getTemuTimeouts),
|
|
36
|
+
((ProsopoTaskRequest,), getProsopoTimeouts),
|
|
37
|
+
((AltchaCustomTaskRequest,), getAltchaTimeouts),
|
|
38
|
+
((CastleCustomTaskRequest,), getCastleTimeouts),
|
|
39
|
+
((TspdCustomTaskRequest,), getTspdTimeouts),
|
|
40
|
+
((HuntCustomTaskRequest,), getHuntTimeouts),
|
|
41
|
+
((FriendlyCaptchaRequest,), getFriendlyCaptchaTimeouts),
|
|
42
|
+
((AlibabaCustomTaskRequest,), getAlibabaTimeouts),
|
|
40
43
|
)
|
|
41
44
|
|
|
42
45
|
|
|
@@ -85,8 +88,6 @@ class CapMonsterClient:
|
|
|
85
88
|
ImageToTextRequest,
|
|
86
89
|
FuncaptchaRequest,
|
|
87
90
|
FunCaptchaComplexImageTaskRequest,
|
|
88
|
-
HcaptchaRequest,
|
|
89
|
-
HcaptchaComplexImageTaskRequest,
|
|
90
91
|
GeetestRequest,
|
|
91
92
|
DataDomeCustomTaskRequest,
|
|
92
93
|
TenDiCustomTaskRequest,
|
|
@@ -100,7 +101,12 @@ class CapMonsterClient:
|
|
|
100
101
|
YidunRequest,
|
|
101
102
|
TemuCustomTaskRequest,
|
|
102
103
|
ProsopoTaskRequest,
|
|
103
|
-
AltchaCustomTaskRequest
|
|
104
|
+
AltchaCustomTaskRequest,
|
|
105
|
+
CastleCustomTaskRequest,
|
|
106
|
+
TspdCustomTaskRequest,
|
|
107
|
+
HuntCustomTaskRequest,
|
|
108
|
+
FriendlyCaptchaRequest,
|
|
109
|
+
AlibabaCustomTaskRequest],
|
|
104
110
|
) -> Dict[str, str]:
|
|
105
111
|
'''
|
|
106
112
|
Non-blocking method for captcha solving.
|
|
@@ -124,8 +130,6 @@ class CapMonsterClient:
|
|
|
124
130
|
ImageToTextRequest,
|
|
125
131
|
FuncaptchaRequest,
|
|
126
132
|
FunCaptchaComplexImageTaskRequest,
|
|
127
|
-
HcaptchaRequest,
|
|
128
|
-
HcaptchaComplexImageTaskRequest,
|
|
129
133
|
GeetestRequest,
|
|
130
134
|
DataDomeCustomTaskRequest,
|
|
131
135
|
TenDiCustomTaskRequest,
|
|
@@ -139,7 +143,9 @@ class CapMonsterClient:
|
|
|
139
143
|
YidunRequest,
|
|
140
144
|
TemuCustomTaskRequest,
|
|
141
145
|
ProsopoTaskRequest,
|
|
142
|
-
AltchaCustomTaskRequest
|
|
146
|
+
AltchaCustomTaskRequest,
|
|
147
|
+
FriendlyCaptchaRequest,
|
|
148
|
+
AlibabaCustomTaskRequest],
|
|
143
149
|
timeouts: GetResultTimeouts,
|
|
144
150
|
) -> Dict[str, str]:
|
|
145
151
|
|
|
@@ -148,6 +154,7 @@ class CapMonsterClient:
|
|
|
148
154
|
raise GetTaskError(f'[{getTaskResponse.get("errorCode")}] ' \
|
|
149
155
|
f'{getTaskResponse.get("errorDescription")}.')
|
|
150
156
|
timer = RequestController(timeout=timeouts.timeout)
|
|
157
|
+
timer.run()
|
|
151
158
|
await asyncio.sleep(timeouts.firstRequestDelay)
|
|
152
159
|
result = CaptchaResult()
|
|
153
160
|
while not timer.cancel:
|
|
@@ -165,13 +172,10 @@ class CapMonsterClient:
|
|
|
165
172
|
elif getResultResponse.get('status') == 'ready':
|
|
166
173
|
timer.stop()
|
|
167
174
|
result.solution = getResultResponse.get('solution')
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
else:
|
|
173
|
-
raise TimeoutError('Failed to get a solution within the maximum ' \
|
|
174
|
-
f'response waiting interval: {timeouts.timeout:0.1f} sec.')
|
|
175
|
+
return result.solution
|
|
176
|
+
|
|
177
|
+
raise TimeoutError('Failed to get a solution within the maximum ' \
|
|
178
|
+
f'response waiting interval: {timeouts.timeout:0.1f} sec.')
|
|
175
179
|
|
|
176
180
|
|
|
177
181
|
async def _getTaskResult(self, task_id: str) -> Dict[str, Union[int, str, None]]:
|
|
@@ -211,4 +215,4 @@ class CapMonsterClient:
|
|
|
211
215
|
raise HTTPException(f'Cannot create task. Status code: {resp.status}.')
|
|
212
216
|
else:
|
|
213
217
|
return await resp.json(content_type=None)
|
|
214
|
-
|
|
218
|
+
|
|
@@ -1,69 +1,106 @@
|
|
|
1
1
|
from typing import Union
|
|
2
2
|
from dataclasses import dataclass
|
|
3
3
|
|
|
4
|
+
|
|
4
5
|
@dataclass
|
|
5
6
|
class GetResultTimeouts:
|
|
6
7
|
firstRequestDelay: Union[int, float]
|
|
7
8
|
firstRequestNoCacheDelay: Union[int, float]
|
|
8
|
-
requestsInterval: Union[int, float]
|
|
9
|
+
requestsInterval: Union[int, float]
|
|
9
10
|
timeout: Union[int, float]
|
|
10
11
|
|
|
12
|
+
|
|
11
13
|
def getRecaptchaV2Timeouts() -> GetResultTimeouts:
|
|
12
14
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
13
15
|
|
|
16
|
+
|
|
14
17
|
def getRecaptchaV2EnterpriseTimeouts() -> GetResultTimeouts:
|
|
15
18
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
16
19
|
|
|
20
|
+
|
|
17
21
|
def getRecaptchaV3Timeouts() -> GetResultTimeouts:
|
|
18
22
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
19
23
|
|
|
24
|
+
|
|
20
25
|
def getRecaptchaV3EnterpriseTimeouts() -> GetResultTimeouts:
|
|
21
26
|
return GetResultTimeouts(1, 10, 3, 150)
|
|
22
27
|
|
|
28
|
+
|
|
23
29
|
def getImage2TextTimeouts() -> GetResultTimeouts:
|
|
24
30
|
return GetResultTimeouts(0.35, 0, 0.2, 10)
|
|
25
31
|
|
|
32
|
+
|
|
26
33
|
def getFuncaptchaTimeouts() -> GetResultTimeouts:
|
|
27
34
|
return GetResultTimeouts(1, 10, 1, 80)
|
|
28
35
|
|
|
29
|
-
def getHcaptchaTimeouts() -> GetResultTimeouts:
|
|
30
|
-
return GetResultTimeouts(1, 10, 3, 180)
|
|
31
36
|
|
|
32
37
|
def getGeetestTimeouts() -> GetResultTimeouts:
|
|
33
38
|
return GetResultTimeouts(1, 0, 1, 80)
|
|
34
39
|
|
|
40
|
+
|
|
35
41
|
def getTurnstileTimeouts() -> GetResultTimeouts:
|
|
36
42
|
return GetResultTimeouts(1, 0, 1, 80)
|
|
37
43
|
|
|
44
|
+
|
|
38
45
|
def getDatadomeTimeouts() -> GetResultTimeouts:
|
|
39
46
|
return GetResultTimeouts(1, 0, 1, 80)
|
|
40
47
|
|
|
48
|
+
|
|
41
49
|
def getTenDiTimeouts() -> GetResultTimeouts:
|
|
42
50
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
43
51
|
|
|
52
|
+
|
|
44
53
|
def getBasiliskTimeouts() -> GetResultTimeouts:
|
|
45
54
|
return GetResultTimeouts(1, 10, 3, 100)
|
|
46
55
|
|
|
56
|
+
|
|
47
57
|
def getAmazonWafTimeouts() -> GetResultTimeouts:
|
|
48
58
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
49
59
|
|
|
60
|
+
|
|
50
61
|
def getBinanceTimeouts() -> GetResultTimeouts:
|
|
51
62
|
return GetResultTimeouts(1, 0, 1, 20)
|
|
52
63
|
|
|
64
|
+
|
|
53
65
|
def getImpervaTimeouts() -> GetResultTimeouts:
|
|
54
66
|
return GetResultTimeouts(1, 0, 1, 20)
|
|
55
67
|
|
|
68
|
+
|
|
56
69
|
def getAltchaTimeouts() -> GetResultTimeouts:
|
|
57
70
|
return GetResultTimeouts(1, 0, 1, 50)
|
|
58
71
|
|
|
72
|
+
|
|
73
|
+
def getCastleTimeouts() -> GetResultTimeouts:
|
|
74
|
+
return GetResultTimeouts(1, 0, 1, 60)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def getTspdTimeouts() -> GetResultTimeouts:
|
|
78
|
+
return GetResultTimeouts(1, 0, 1, 60)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def getHuntTimeouts() -> GetResultTimeouts:
|
|
82
|
+
return GetResultTimeouts(1, 0, 1, 60)
|
|
83
|
+
|
|
84
|
+
|
|
59
85
|
def getCITTimeouts() -> GetResultTimeouts:
|
|
60
86
|
return GetResultTimeouts(0.35, 0, 0.2, 10)
|
|
61
87
|
|
|
88
|
+
|
|
62
89
|
def getYidunTimeouts() -> GetResultTimeouts:
|
|
63
90
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
64
91
|
|
|
92
|
+
|
|
65
93
|
def getProsopoTimeouts() -> GetResultTimeouts:
|
|
66
94
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
67
95
|
|
|
96
|
+
|
|
68
97
|
def getTemuTimeouts() -> GetResultTimeouts:
|
|
69
98
|
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)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from typing import Dict, Union
|
|
2
|
+
from pydantic import Field, validator
|
|
3
|
+
|
|
4
|
+
from .CustomTaskRequestBase import CustomTaskRequestBase
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AlibabaCustomTaskRequest(CustomTaskRequestBase):
|
|
8
|
+
captchaClass: str = Field(default='alibaba')
|
|
9
|
+
metadata: Dict[str, str]
|
|
10
|
+
|
|
11
|
+
@validator('metadata')
|
|
12
|
+
def validate_metadata(cls, value):
|
|
13
|
+
allowed_keys = {'sceneId', 'prefix', 'userId', 'userUserId', 'verifyType',
|
|
14
|
+
'region', 'UserCertifyId', 'apiGetLib'}
|
|
15
|
+
unknown = set(value.keys()) - allowed_keys
|
|
16
|
+
if unknown:
|
|
17
|
+
raise TypeError(f'Unexpected metadata keys: {unknown}. Allowed: {allowed_keys}')
|
|
18
|
+
for key in ['sceneId', 'prefix']:
|
|
19
|
+
if value.get(key) is None:
|
|
20
|
+
raise TypeError(f'Expect that {key} will be defined.')
|
|
21
|
+
if not isinstance(value[key], str):
|
|
22
|
+
raise TypeError(f'Expect that {key} will be str.')
|
|
23
|
+
for key in ['userId', 'userUserId', 'verifyType', 'region', 'UserCertifyId', 'apiGetLib']:
|
|
24
|
+
if key in value and not isinstance(value[key], str):
|
|
25
|
+
raise TypeError(f'Expect that {key} will be str.')
|
|
26
|
+
return value
|
|
27
|
+
|
|
28
|
+
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
29
|
+
task = {}
|
|
30
|
+
task['type'] = self.type
|
|
31
|
+
task['class'] = self.captchaClass
|
|
32
|
+
task['websiteURL'] = self.websiteUrl
|
|
33
|
+
task['metadata'] = self.metadata
|
|
34
|
+
if self.proxy:
|
|
35
|
+
task['proxyType'] = self.proxy.proxyType
|
|
36
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
|
37
|
+
task['proxyPort'] = self.proxy.proxyPort
|
|
38
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
|
39
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
|
40
|
+
if self.userAgent is not None:
|
|
41
|
+
task['userAgent'] = self.userAgent
|
|
42
|
+
return task
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from typing import Dict, Union
|
|
2
|
+
from pydantic import Field, validator
|
|
3
|
+
|
|
4
|
+
from .CustomTaskRequestBase import CustomTaskRequestBase
|
|
5
|
+
|
|
6
|
+
class CastleCustomTaskRequest(CustomTaskRequestBase):
|
|
7
|
+
captchaClass: str = Field(default='Castle')
|
|
8
|
+
websiteKey: str = Field()
|
|
9
|
+
metadata: Dict[str, Union[str, int]]
|
|
10
|
+
|
|
11
|
+
@validator('metadata')
|
|
12
|
+
def validate_metadata(cls, value):
|
|
13
|
+
if value.get('wUrl') is None:
|
|
14
|
+
raise TypeError(f'Expected that wUrl is defined.')
|
|
15
|
+
else:
|
|
16
|
+
if not isinstance(value.get('wUrl'), str):
|
|
17
|
+
raise TypeError(f'Expected that wUrl is str.')
|
|
18
|
+
if value.get('swUrl') is None:
|
|
19
|
+
raise TypeError(f'Expected that swUrl is defined.')
|
|
20
|
+
else:
|
|
21
|
+
if not isinstance(value.get('swUrl'), str):
|
|
22
|
+
raise TypeError(f'Expected that swUrl is str.')
|
|
23
|
+
if value.get('count') is not None and not isinstance(value.get('count'), int):
|
|
24
|
+
raise TypeError(f'Expected that count is int.')
|
|
25
|
+
return value
|
|
26
|
+
|
|
27
|
+
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
28
|
+
task = {}
|
|
29
|
+
task['type'] = self.type
|
|
30
|
+
task['class'] = self.captchaClass
|
|
31
|
+
task['websiteURL'] = self.websiteUrl
|
|
32
|
+
task['websiteKey'] = self.websiteKey
|
|
33
|
+
task['metadata'] = self.metadata
|
|
34
|
+
if self.proxy:
|
|
35
|
+
task['proxyType'] = self.proxy.proxyType
|
|
36
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
|
37
|
+
task['proxyPort'] = self.proxy.proxyPort
|
|
38
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
|
39
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
|
40
|
+
if self.userAgent is not None:
|
|
41
|
+
task['userAgent'] = self.userAgent
|
|
42
|
+
return task
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
from typing import Dict, Union
|
|
2
|
-
from pydantic import Field, validator
|
|
2
|
+
from pydantic import Field, validator, model_validator
|
|
3
3
|
from .CustomTaskRequestBase import CustomTaskRequestBase
|
|
4
4
|
|
|
5
5
|
class DataDomeCustomTaskRequest(CustomTaskRequestBase):
|
|
6
6
|
captchaClass: str = Field(default='DataDome')
|
|
7
7
|
metadata : Dict[str, str]
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
@validator('metadata')
|
|
10
10
|
def validate_metadata(cls, value):
|
|
11
11
|
if value.get('datadomeCookie') is None:
|
|
12
12
|
raise TypeError(f'Expect that datadomeCookie will be defined.')
|
|
13
|
+
if value.get('datadomeVersion') is not None and not isinstance(value.get('datadomeVersion'), str):
|
|
14
|
+
raise TypeError(f'Expected datadomeVersion to be str')
|
|
13
15
|
if value.get('captchaUrl') and value.get('htmlPageBase64'):
|
|
14
16
|
raise TypeError(f'Expected only one of [captchaUrl, htmlPageBase64]')
|
|
15
17
|
elif value.get('captchaUrl'):
|
|
@@ -18,22 +20,24 @@ class DataDomeCustomTaskRequest(CustomTaskRequestBase):
|
|
|
18
20
|
return {i: value[i] for i in value if i != 'captchaUrl'}
|
|
19
21
|
else:
|
|
20
22
|
raise TypeError(f'Expected one of [captchaUrl, htmlPageBase64]')
|
|
21
|
-
if value.get('datadomeVersion') and not isinstance(value.get('datadomeVersion'), str):
|
|
22
|
-
raise TypeError(f'Expected datadomeVersion to be str')
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
@model_validator(mode='before')
|
|
25
|
+
def validate_datadome_proxy(cls, values):
|
|
26
|
+
proxy = values.get('proxy')
|
|
27
|
+
if proxy is None:
|
|
28
|
+
raise RuntimeError(f'You are required to use your own proxies.')
|
|
29
|
+
return values
|
|
30
|
+
|
|
25
31
|
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
26
32
|
task = {}
|
|
27
33
|
task['type'] = self.type
|
|
28
34
|
task['class'] = self.captchaClass
|
|
29
35
|
task['websiteURL'] = self.websiteUrl
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
task['proxyPassword'] = self.proxy.proxyPassword
|
|
36
|
-
task['domains'] = self.domains
|
|
36
|
+
task['proxyType'] = self.proxy.proxyType
|
|
37
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
|
38
|
+
task['proxyPort'] = self.proxy.proxyPort
|
|
39
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
|
40
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
|
37
41
|
task['metadata'] = self.metadata
|
|
38
42
|
if self.userAgent is not None:
|
|
39
43
|
task['userAgent'] = self.userAgent
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
from typing import Dict, Union
|
|
2
|
-
from pydantic import Field
|
|
2
|
+
from pydantic import Field, validator
|
|
3
3
|
|
|
4
4
|
from .CustomTaskRequestBase import CustomTaskRequestBase
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
class FriendlyCaptchaRequest(CustomTaskRequestBase):
|
|
8
|
+
captchaClass: str = Field(default='friendly')
|
|
8
9
|
websiteKey: str = Field()
|
|
10
|
+
metadata: Dict[str, str]
|
|
11
|
+
|
|
12
|
+
@validator('metadata')
|
|
13
|
+
def validate_metadata(cls, value):
|
|
14
|
+
if value.get('apiGetLib') is None:
|
|
15
|
+
raise TypeError('Expect that apiGetLib will be defined.')
|
|
16
|
+
if not isinstance(value['apiGetLib'], str):
|
|
17
|
+
raise TypeError('Expect that apiGetLib will be str.')
|
|
18
|
+
return value
|
|
9
19
|
|
|
10
20
|
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
11
21
|
task = {}
|
|
@@ -13,6 +23,7 @@ class TenDiCustomTaskRequest(CustomTaskRequestBase):
|
|
|
13
23
|
task['class'] = self.captchaClass
|
|
14
24
|
task['websiteURL'] = self.websiteUrl
|
|
15
25
|
task['websiteKey'] = self.websiteKey
|
|
26
|
+
task['metadata'] = self.metadata
|
|
16
27
|
if self.proxy:
|
|
17
28
|
task['proxyType'] = self.proxy.proxyType
|
|
18
29
|
task['proxyAddress'] = self.proxy.proxyAddress
|
|
@@ -21,4 +32,4 @@ class TenDiCustomTaskRequest(CustomTaskRequestBase):
|
|
|
21
32
|
task['proxyPassword'] = self.proxy.proxyPassword
|
|
22
33
|
if self.userAgent is not None:
|
|
23
34
|
task['userAgent'] = self.userAgent
|
|
24
|
-
return task
|
|
35
|
+
return task
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from typing import Dict, Union
|
|
2
|
+
from pydantic import Field, validator, model_validator
|
|
3
|
+
|
|
4
|
+
from .CustomTaskRequestBase import CustomTaskRequestBase
|
|
5
|
+
|
|
6
|
+
class HuntCustomTaskRequest(CustomTaskRequestBase):
|
|
7
|
+
captchaClass: str = Field(default='HUNT')
|
|
8
|
+
metadata: Dict[str, str]
|
|
9
|
+
|
|
10
|
+
@validator('metadata')
|
|
11
|
+
def validate_metadata(cls, value):
|
|
12
|
+
if value.get('apiGetLib') is None:
|
|
13
|
+
raise TypeError(f'Expect that apiGetLib will be defined.')
|
|
14
|
+
else:
|
|
15
|
+
if not isinstance(value.get('apiGetLib'), str):
|
|
16
|
+
raise TypeError(f'Expect that apiGetLib will be str.')
|
|
17
|
+
if value.get('data') is not None and not isinstance(value.get('data'), str):
|
|
18
|
+
raise TypeError(f'Expect that data will be str.')
|
|
19
|
+
return value
|
|
20
|
+
|
|
21
|
+
@model_validator(mode='before')
|
|
22
|
+
def validate_hunt_proxy(cls, values):
|
|
23
|
+
proxy = values.get('proxy')
|
|
24
|
+
if proxy is None:
|
|
25
|
+
raise RuntimeError(f'You are required to use your own proxies.')
|
|
26
|
+
return values
|
|
27
|
+
|
|
28
|
+
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
29
|
+
task = {}
|
|
30
|
+
task['type'] = self.type
|
|
31
|
+
task['class'] = self.captchaClass
|
|
32
|
+
task['websiteURL'] = self.websiteUrl
|
|
33
|
+
task['metadata'] = self.metadata
|
|
34
|
+
task['proxyType'] = self.proxy.proxyType
|
|
35
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
|
36
|
+
task['proxyPort'] = self.proxy.proxyPort
|
|
37
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
|
38
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
|
39
|
+
if self.userAgent is not None:
|
|
40
|
+
task['userAgent'] = self.userAgent
|
|
41
|
+
return task
|