capmonstercloudclient 3.2.0__tar.gz → 3.4.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.2.0/capmonstercloudclient.egg-info → capmonstercloudclient-3.4.0}/PKG-INFO +1 -1
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/CapMonsterCloudClient.py +32 -6
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/GetResultTimeouts.py +15 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/clientOptions.py +4 -1
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/exceptions.py +2 -0
- capmonstercloudclient-3.4.0/capmonstercloud_client/requests/AltchaCustomTaskRequest.py +36 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/CustomTaskRequestBase.py +2 -2
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/DataDomeCustomTaskRequest.py +3 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/FuncaptchaRequest.py +3 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/ImpervaCustomTaskRequest.py +13 -7
- capmonstercloudclient-3.4.0/capmonstercloud_client/requests/ProsopoTaskRequest.py +23 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/RecaptchaV2EnterpiseRequest.py +3 -0
- capmonstercloudclient-3.4.0/capmonstercloud_client/requests/RecaptchaV3EnterpriseRequest.py +22 -0
- capmonstercloudclient-3.4.0/capmonstercloud_client/requests/TemuCustomTaskRequest.py +35 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/TurnstileRequest.py +6 -6
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/__init__.py +13 -3
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/proxy_info.py +20 -0
- capmonstercloudclient-3.4.0/capmonstercloud_client/version.txt +1 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0/capmonstercloudclient.egg-info}/PKG-INFO +1 -1
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloudclient.egg-info/SOURCES.txt +4 -0
- capmonstercloudclient-3.2.0/capmonstercloud_client/version.txt +0 -1
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/LICENSE +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/MANIFEST.in +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/README.md +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/__init__.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/captchaResult.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requestController.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/AmazonWafRequest.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/BasiliskCustomTaskRequest.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/BinanceTaskRequest.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/ComplexImageTaskBase.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/FuncaptchaComplexImageTask.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/GeetestRequest.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/HcaptchaComplexImageTask.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/HcaptchaRequest.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/ImageToTextRequest.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/MTCaptchaRequest.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/RecaptchaComplexImageTask.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/RecaptchaV2Request.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/RecaptchaV3ProxylessRequest.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/RecognitionComplexImageTaskRequest.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/TenDiCustomTaskRequest.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/YidunRequest.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/baseRequest.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/baseRequestWithProxy.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/enums.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/utils.py +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloudclient.egg-info/dependency_links.txt +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloudclient.egg-info/requires.txt +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloudclient.egg-info/top_level.txt +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/pyproject.toml +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/requirements.txt +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/setup.cfg +0 -0
- {capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/setup.py +0 -0
|
@@ -17,6 +17,7 @@ _instance_config = (
|
|
|
17
17
|
((RecaptchaV2Request,), getRecaptchaV2Timeouts),
|
|
18
18
|
((RecaptchaV2EnterpriseRequest,), getRecaptchaV2EnterpriseTimeouts),
|
|
19
19
|
((RecaptchaV3ProxylessRequest), getRecaptchaV3Timeouts),
|
|
20
|
+
((RecaptchaV3EnterpriseRequest), getRecaptchaV3Timeouts),
|
|
20
21
|
((ImageToTextRequest), getImage2TextTimeouts),
|
|
21
22
|
((FuncaptchaRequest,), getFuncaptchaTimeouts),
|
|
22
23
|
((HcaptchaRequest,), getHcaptchaTimeouts),
|
|
@@ -32,7 +33,10 @@ _instance_config = (
|
|
|
32
33
|
((ImpervaCustomTaskRequest,), getImpervaTimeouts),
|
|
33
34
|
((RecognitionComplexImageTaskRequest), getCITTimeouts),
|
|
34
35
|
((MTCaptchaRequest), getImage2TextTimeouts),
|
|
35
|
-
((YidunRequest),
|
|
36
|
+
((YidunRequest), getYidunTimeouts),
|
|
37
|
+
((TemuCustomTaskRequest), getTemuTimeouts),
|
|
38
|
+
((ProsopoTaskRequest), getProsopoTimeouts),
|
|
39
|
+
((AltchaCustomTaskRequest), getAltchaTimeouts),
|
|
36
40
|
)
|
|
37
41
|
|
|
38
42
|
|
|
@@ -42,6 +46,14 @@ class CapMonsterClient:
|
|
|
42
46
|
self.options = options
|
|
43
47
|
self._headers = {'User-Agent':
|
|
44
48
|
f'Zennolab.CapMonsterCloud.Client.Python/{parseVersion()}'}
|
|
49
|
+
if self.options.client_proxy:
|
|
50
|
+
if self.options.client_proxy.proxyType not in ['http', 'https']:
|
|
51
|
+
raise UnsupportedProxyTypeError(f'Supported client proxy types are: [HTTP, HTTPS]')
|
|
52
|
+
if self.options.client_proxy.proxyLogin and self.options.client_proxy.proxyPassword:
|
|
53
|
+
auth = f"{self.options.client_proxy.proxyLogin}:{self.options.client_proxy.proxyPassword}@"
|
|
54
|
+
self.client_proxy_string = f"{self.options.client_proxy.proxyType}://{auth}{self.options.client_proxy.proxyAddress}:{self.options.client_proxy.proxyPort}"
|
|
55
|
+
else:
|
|
56
|
+
self.client_proxy_string = None
|
|
45
57
|
|
|
46
58
|
@property
|
|
47
59
|
def headers(self):
|
|
@@ -54,7 +66,8 @@ class CapMonsterClient:
|
|
|
54
66
|
async with aiohttp.ClientSession() as session:
|
|
55
67
|
async with session.post(url=self.options.service_url + '/getBalance',
|
|
56
68
|
json=body,
|
|
57
|
-
timeout=aiohttp.ClientTimeout(total=self.options.client_timeout)
|
|
69
|
+
timeout=aiohttp.ClientTimeout(total=self.options.client_timeout),
|
|
70
|
+
proxy=self.client_proxy_string) as resp:
|
|
58
71
|
if resp.status != 200:
|
|
59
72
|
raise HTTPException(f'Cannot create task. Status code: {resp.status}.')
|
|
60
73
|
result = await resp.json(content_type=None)
|
|
@@ -67,6 +80,7 @@ class CapMonsterClient:
|
|
|
67
80
|
RecaptchaV2EnterpriseRequest,
|
|
68
81
|
RecaptchaV2Request,
|
|
69
82
|
RecaptchaV3ProxylessRequest,
|
|
83
|
+
RecaptchaV3EnterpriseRequest,
|
|
70
84
|
RecaptchaComplexImageTaskRequest,
|
|
71
85
|
ImageToTextRequest,
|
|
72
86
|
FuncaptchaRequest,
|
|
@@ -83,7 +97,10 @@ class CapMonsterClient:
|
|
|
83
97
|
TurnstileRequest,
|
|
84
98
|
RecognitionComplexImageTaskRequest,
|
|
85
99
|
MTCaptchaRequest,
|
|
86
|
-
YidunRequest
|
|
100
|
+
YidunRequest,
|
|
101
|
+
TemuCustomTaskRequest,
|
|
102
|
+
ProsopoTaskRequest,
|
|
103
|
+
AltchaCustomTaskRequest],
|
|
87
104
|
) -> Dict[str, str]:
|
|
88
105
|
'''
|
|
89
106
|
Non-blocking method for captcha solving.
|
|
@@ -102,6 +119,7 @@ class CapMonsterClient:
|
|
|
102
119
|
RecaptchaV2EnterpriseRequest,
|
|
103
120
|
RecaptchaV2Request,
|
|
104
121
|
RecaptchaV3ProxylessRequest,
|
|
122
|
+
RecaptchaV3EnterpriseRequest,
|
|
105
123
|
RecaptchaComplexImageTaskRequest,
|
|
106
124
|
ImageToTextRequest,
|
|
107
125
|
FuncaptchaRequest,
|
|
@@ -116,7 +134,12 @@ class CapMonsterClient:
|
|
|
116
134
|
BinanceTaskRequest,
|
|
117
135
|
ImpervaCustomTaskRequest,
|
|
118
136
|
TurnstileRequest,
|
|
119
|
-
RecognitionComplexImageTaskRequest
|
|
137
|
+
RecognitionComplexImageTaskRequest,
|
|
138
|
+
MTCaptchaRequest,
|
|
139
|
+
YidunRequest,
|
|
140
|
+
TemuCustomTaskRequest,
|
|
141
|
+
ProsopoTaskRequest,
|
|
142
|
+
AltchaCustomTaskRequest],
|
|
120
143
|
timeouts: GetResultTimeouts,
|
|
121
144
|
) -> Dict[str, str]:
|
|
122
145
|
|
|
@@ -160,7 +183,8 @@ class CapMonsterClient:
|
|
|
160
183
|
async with session.post(url=self.options.service_url + '/getTaskResult',
|
|
161
184
|
json=body,
|
|
162
185
|
timeout=aiohttp.ClientTimeout(total=self.options.client_timeout),
|
|
163
|
-
headers=self.headers
|
|
186
|
+
headers=self.headers,
|
|
187
|
+
proxy=self.client_proxy_string) as resp:
|
|
164
188
|
if resp.status != 200:
|
|
165
189
|
if resp.status == 500:
|
|
166
190
|
return {'errorId': 0, 'status': 'processing'}
|
|
@@ -176,11 +200,13 @@ class CapMonsterClient:
|
|
|
176
200
|
"task": task,
|
|
177
201
|
"softId": self.options.default_soft_id
|
|
178
202
|
}
|
|
203
|
+
|
|
179
204
|
async with aiohttp.ClientSession() as session:
|
|
180
205
|
async with session.post(url=self.options.service_url + '/createTask',
|
|
181
206
|
json=body,
|
|
182
207
|
timeout=aiohttp.ClientTimeout(total=self.options.client_timeout),
|
|
183
|
-
headers=self.headers
|
|
208
|
+
headers=self.headers,
|
|
209
|
+
proxy=self.client_proxy_string) as resp:
|
|
184
210
|
if resp.status != 200:
|
|
185
211
|
raise HTTPException(f'Cannot create task. Status code: {resp.status}.')
|
|
186
212
|
else:
|
|
@@ -17,6 +17,9 @@ def getRecaptchaV2EnterpriseTimeouts() -> GetResultTimeouts:
|
|
|
17
17
|
def getRecaptchaV3Timeouts() -> GetResultTimeouts:
|
|
18
18
|
return GetResultTimeouts(1, 10, 3, 180)
|
|
19
19
|
|
|
20
|
+
def getRecaptchaV3EnterpriseTimeouts() -> GetResultTimeouts:
|
|
21
|
+
return GetResultTimeouts(1, 10, 3, 150)
|
|
22
|
+
|
|
20
23
|
def getImage2TextTimeouts() -> GetResultTimeouts:
|
|
21
24
|
return GetResultTimeouts(0.35, 0, 0.2, 10)
|
|
22
25
|
|
|
@@ -50,5 +53,17 @@ def getBinanceTimeouts() -> GetResultTimeouts:
|
|
|
50
53
|
def getImpervaTimeouts() -> GetResultTimeouts:
|
|
51
54
|
return GetResultTimeouts(1, 0, 1, 20)
|
|
52
55
|
|
|
56
|
+
def getAltchaTimeouts() -> GetResultTimeouts:
|
|
57
|
+
return GetResultTimeouts(1, 0, 1, 50)
|
|
58
|
+
|
|
53
59
|
def getCITTimeouts() -> GetResultTimeouts:
|
|
54
60
|
return GetResultTimeouts(0.35, 0, 0.2, 10)
|
|
61
|
+
|
|
62
|
+
def getYidunTimeouts() -> GetResultTimeouts:
|
|
63
|
+
return GetResultTimeouts(1, 10, 3, 180)
|
|
64
|
+
|
|
65
|
+
def getProsopoTimeouts() -> GetResultTimeouts:
|
|
66
|
+
return GetResultTimeouts(1, 10, 3, 180)
|
|
67
|
+
|
|
68
|
+
def getTemuTimeouts() -> GetResultTimeouts:
|
|
69
|
+
return GetResultTimeouts(1, 10, 3, 180)
|
{capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/clientOptions.py
RENAMED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
from pydantic import BaseModel, validator, Field
|
|
2
|
-
|
|
2
|
+
from .requests import ClientProxyInfo
|
|
3
|
+
from typing import Optional
|
|
3
4
|
|
|
4
5
|
class ClientOptions(BaseModel):
|
|
5
6
|
api_key: str
|
|
7
|
+
client_proxy: Optional[ClientProxyInfo] = None
|
|
6
8
|
service_url: str = Field(default="https://api.capmonster.cloud")
|
|
7
9
|
default_soft_id: int = Field(default=55)
|
|
8
10
|
client_timeout: float = Field(default=20.0)
|
|
11
|
+
|
|
9
12
|
|
|
10
13
|
@validator('api_key')
|
|
11
14
|
def validate_api_key(cls, value):
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from typing import Dict, Union
|
|
2
|
+
from pydantic import Field, validator
|
|
3
|
+
|
|
4
|
+
from .CustomTaskRequestBase import CustomTaskRequestBase
|
|
5
|
+
|
|
6
|
+
class AltchaCustomTaskRequest(CustomTaskRequestBase):
|
|
7
|
+
captchaClass: str = Field(default='altcha')
|
|
8
|
+
websiteKey: str = Field()
|
|
9
|
+
metadata : Dict[str, str]
|
|
10
|
+
|
|
11
|
+
@validator('metadata')
|
|
12
|
+
def validate_metadata(cls, value):
|
|
13
|
+
for key in ['challenge', 'iterations', 'salt', 'signature']:
|
|
14
|
+
if value.get(key) is None:
|
|
15
|
+
raise TypeError(f'Expect that {key} will be defined.')
|
|
16
|
+
else:
|
|
17
|
+
if not isinstance(value.get(key), str):
|
|
18
|
+
raise TypeError(f'Expect that {key} will be str.')
|
|
19
|
+
return value
|
|
20
|
+
|
|
21
|
+
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
22
|
+
task = {}
|
|
23
|
+
task['type'] = self.type
|
|
24
|
+
task['class'] = self.captchaClass
|
|
25
|
+
task['websiteURL'] = self.websiteUrl
|
|
26
|
+
task['websiteKey'] = self.websiteKey
|
|
27
|
+
task['metadata'] = self.metadata
|
|
28
|
+
if self.proxy:
|
|
29
|
+
task['proxyType'] = self.proxy.proxyType
|
|
30
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
|
31
|
+
task['proxyPort'] = self.proxy.proxyPort
|
|
32
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
|
33
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
|
34
|
+
if self.userAgent is not None:
|
|
35
|
+
task['userAgent'] = self.userAgent
|
|
36
|
+
return task
|
|
@@ -6,5 +6,5 @@ class CustomTaskRequestBase(BaseRequestWithProxy):
|
|
|
6
6
|
captchaClass: str # Class(subtype) of ComplexImageTask
|
|
7
7
|
type: str = "CustomTask" # Recognition task type
|
|
8
8
|
websiteUrl: str # Address of a webpage with captcha
|
|
9
|
-
userAgent: Optional[str] = None
|
|
10
|
-
domains: Optional[List[str]] = None
|
|
9
|
+
userAgent: Optional[str] = None
|
|
10
|
+
domains: Optional[List[str]] = None
|
|
@@ -18,6 +18,9 @@ class DataDomeCustomTaskRequest(CustomTaskRequestBase):
|
|
|
18
18
|
return {i: value[i] for i in value if i != 'captchaUrl'}
|
|
19
19
|
else:
|
|
20
20
|
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
|
+
|
|
21
24
|
|
|
22
25
|
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
23
26
|
task = {}
|
|
@@ -9,6 +9,7 @@ class FuncaptchaRequest(BaseRequestWithProxy):
|
|
|
9
9
|
websitePublicKey: str
|
|
10
10
|
funcaptchaApiJSSubdomain: Optional[str] = Field(default=None)
|
|
11
11
|
data: Optional[str] = Field(default=None)
|
|
12
|
+
cookies: Optional[str] = Field(default=None)
|
|
12
13
|
|
|
13
14
|
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
14
15
|
task = {}
|
|
@@ -26,4 +27,6 @@ class FuncaptchaRequest(BaseRequestWithProxy):
|
|
|
26
27
|
task['funcaptchaApiJSSubdomain'] = self.funcaptchaApiJSSubdomain
|
|
27
28
|
if self.data is not None:
|
|
28
29
|
task['data'] = self.data
|
|
30
|
+
if self.cookies is not None:
|
|
31
|
+
task['cookies'] = self.cookies
|
|
29
32
|
return task
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from typing import Dict, Union
|
|
2
|
-
from pydantic import Field, validator
|
|
2
|
+
from pydantic import Field, validator, model_validator
|
|
3
3
|
|
|
4
4
|
from .CustomTaskRequestBase import CustomTaskRequestBase
|
|
5
5
|
|
|
@@ -23,18 +23,24 @@ class ImpervaCustomTaskRequest(CustomTaskRequestBase):
|
|
|
23
23
|
raise TypeError(f'Expect that reese84UrlEndpoint will be str.')
|
|
24
24
|
return value
|
|
25
25
|
|
|
26
|
+
@model_validator(mode='before')
|
|
27
|
+
def validate_imperva_proxy(cls, values):
|
|
28
|
+
proxy = values.get('proxy')
|
|
29
|
+
if proxy is None:
|
|
30
|
+
raise RuntimeError(f'You are required to use your own proxies.')
|
|
31
|
+
return values
|
|
32
|
+
|
|
26
33
|
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
27
34
|
task = {}
|
|
28
35
|
task['type'] = self.type
|
|
29
36
|
task['class'] = self.captchaClass
|
|
30
37
|
task['websiteURL'] = self.websiteUrl
|
|
31
38
|
task['metadata'] = self.metadata
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
task['proxyPassword'] = self.proxy.proxyPassword
|
|
39
|
+
task['proxyType'] = self.proxy.proxyType
|
|
40
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
|
41
|
+
task['proxyPort'] = self.proxy.proxyPort
|
|
42
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
|
43
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
|
38
44
|
if self.userAgent is not None:
|
|
39
45
|
task['userAgent'] = self.userAgent
|
|
40
46
|
return task
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from typing import Dict, Union
|
|
2
|
+
from pydantic import Field
|
|
3
|
+
from .baseRequestWithProxy import BaseRequestWithProxy
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ProsopoTaskRequest(BaseRequestWithProxy):
|
|
7
|
+
type: str = Field(default="ProsopoTask")
|
|
8
|
+
websiteUrl: str
|
|
9
|
+
websiteKey: str
|
|
10
|
+
|
|
11
|
+
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
12
|
+
task = {}
|
|
13
|
+
task["type"] = self.type
|
|
14
|
+
task["websiteURL"] = self.websiteUrl
|
|
15
|
+
task["websiteKey"] = self.websiteKey
|
|
16
|
+
if self.proxy:
|
|
17
|
+
task["proxyType"] = self.proxy.proxyType
|
|
18
|
+
task["proxyAddress"] = self.proxy.proxyAddress
|
|
19
|
+
task["proxyPort"] = self.proxy.proxyPort
|
|
20
|
+
task["proxyLogin"] = self.proxy.proxyLogin
|
|
21
|
+
task["proxyPassword"] = self.proxy.proxyPassword
|
|
22
|
+
|
|
23
|
+
return task
|
|
@@ -9,6 +9,7 @@ class RecaptchaV2EnterpriseRequest(BaseRequestWithProxy):
|
|
|
9
9
|
websiteKey: str
|
|
10
10
|
enterprisePayload: Optional[str] = Field(default=None)
|
|
11
11
|
apiDomain: Optional[str] = Field(default=None)
|
|
12
|
+
pageAction: Optional[str] = Field(default=None)
|
|
12
13
|
|
|
13
14
|
def getTaskDict(self) -> Dict[str, Union[str, int]]:
|
|
14
15
|
task = {}
|
|
@@ -25,4 +26,6 @@ class RecaptchaV2EnterpriseRequest(BaseRequestWithProxy):
|
|
|
25
26
|
task['enterprisePayload'] = {'s': self.enterprisePayload}
|
|
26
27
|
if self.apiDomain is not None:
|
|
27
28
|
task['apiDomain'] = self.apiDomain
|
|
29
|
+
if self.pageAction is not None:
|
|
30
|
+
task['pageAction'] = self.pageAction
|
|
28
31
|
return task
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from typing import Dict, Union, Optional
|
|
2
|
+
from pydantic import Field
|
|
3
|
+
|
|
4
|
+
from .baseRequest import BaseRequest
|
|
5
|
+
|
|
6
|
+
class RecaptchaV3EnterpriseRequest(BaseRequest):
|
|
7
|
+
type: str = Field(default='RecaptchaV3EnterpriseTask')
|
|
8
|
+
websiteUrl: str
|
|
9
|
+
websiteKey: str
|
|
10
|
+
minScore: Optional[float] = Field(default=None)
|
|
11
|
+
pageAction: Optional[str] = Field(default=None)
|
|
12
|
+
|
|
13
|
+
def getTaskDict(self) -> Dict[str, Union[str, int, float]]:
|
|
14
|
+
task = {}
|
|
15
|
+
task['type'] = self.type
|
|
16
|
+
task['websiteURL'] = self.websiteUrl
|
|
17
|
+
task['websiteKey'] = self.websiteKey
|
|
18
|
+
if self.minScore is not None:
|
|
19
|
+
task['minScore'] = self.minScore
|
|
20
|
+
if self.pageAction is not None:
|
|
21
|
+
task['pageAction'] = self.pageAction
|
|
22
|
+
return task
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from typing import Dict, Union
|
|
2
|
+
from pydantic import Field, validator
|
|
3
|
+
|
|
4
|
+
from .CustomTaskRequestBase import CustomTaskRequestBase
|
|
5
|
+
|
|
6
|
+
class TemuCustomTaskRequest(CustomTaskRequestBase):
|
|
7
|
+
captchaClass: str = Field(default='Temu')
|
|
8
|
+
metadata: Dict[str, str]
|
|
9
|
+
|
|
10
|
+
@validator('metadata')
|
|
11
|
+
def validate_metadata(cls, value):
|
|
12
|
+
if value.get('cookie') is None:
|
|
13
|
+
raise TypeError(f'Expect that cookie will be defined.')
|
|
14
|
+
else:
|
|
15
|
+
if not isinstance(value.get('cookie'), str):
|
|
16
|
+
raise TypeError(f'Expect that cookie will be str.')
|
|
17
|
+
if not set(value.keys()).issubset(set(["cookie"])):
|
|
18
|
+
raise TypeError(f'Allowed keys for metadata are "cookie"')
|
|
19
|
+
return value
|
|
20
|
+
|
|
21
|
+
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
|
22
|
+
task = {}
|
|
23
|
+
task['type'] = self.type
|
|
24
|
+
task['class'] = self.captchaClass
|
|
25
|
+
task['websiteURL'] = self.websiteUrl
|
|
26
|
+
task['metadata'] = self.metadata
|
|
27
|
+
if self.proxy:
|
|
28
|
+
task['proxyType'] = self.proxy.proxyType
|
|
29
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
|
30
|
+
task['proxyPort'] = self.proxy.proxyPort
|
|
31
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
|
32
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
|
33
|
+
if self.userAgent is not None:
|
|
34
|
+
task['userAgent'] = self.userAgent
|
|
35
|
+
return task
|
|
@@ -19,7 +19,7 @@ class TurnstileRequest(BaseRequestWithProxy):
|
|
|
19
19
|
@validator('cloudflareTaskType')
|
|
20
20
|
def validate_cloudflare_task(cls, value):
|
|
21
21
|
if value is not None:
|
|
22
|
-
if value not in ['cf_clearance', 'token']:
|
|
22
|
+
if value not in ['cf_clearance', 'token', 'wait_room']:
|
|
23
23
|
raise ValueError(f'cloudflareTaskType could be "cf_clearance" if you need cookie or ' \
|
|
24
24
|
f'"token" if required token from Turnstile.')
|
|
25
25
|
return value
|
|
@@ -28,13 +28,13 @@ class TurnstileRequest(BaseRequestWithProxy):
|
|
|
28
28
|
def validate_cloudflare_type_token(self):
|
|
29
29
|
|
|
30
30
|
if self.get('htmlPageBase64') is None:
|
|
31
|
-
if self.get('cloudflareTaskType')
|
|
31
|
+
if self.get('cloudflareTaskType') in ['cf_clearance', 'wait_room']:
|
|
32
32
|
raise RuntimeError(f'Expect that "htmlPageBase64" will be filled ' \
|
|
33
|
-
f'when cloudflareTaskType is "cf_clearance"')
|
|
33
|
+
f'when cloudflareTaskType is "cf_clearance" or "wait_room')
|
|
34
34
|
|
|
35
35
|
if self.get('proxy') is None:
|
|
36
|
-
if self.get('cloudflareTaskType')
|
|
37
|
-
raise RuntimeError(f'You are working using queries, and you need cf_clearance cookies ' \
|
|
36
|
+
if self.get('cloudflareTaskType') in ['cf_clearance', 'wait_room']:
|
|
37
|
+
raise RuntimeError(f'You are working using queries, and you need cf_clearance cookies or wait_room ' \
|
|
38
38
|
f'it is required that you need your proxies.')
|
|
39
39
|
|
|
40
40
|
if self.get('cloudflareTaskType') == 'token':
|
|
@@ -44,7 +44,7 @@ class TurnstileRequest(BaseRequestWithProxy):
|
|
|
44
44
|
f'when "cloudflareTaskType" = "token".')
|
|
45
45
|
|
|
46
46
|
if self.get('cloudflareTaskType') is not None:
|
|
47
|
-
if self.get('cloudflareTaskType') in ['cf_clearance', 'token']:
|
|
47
|
+
if self.get('cloudflareTaskType') in ['cf_clearance', 'token', 'wait_room']:
|
|
48
48
|
if self.get('userAgent') is None:
|
|
49
49
|
raise RuntimeError(f'Expect that userAgent will be filled ' \
|
|
50
50
|
f'when cloudflareTaskType specified.')
|
|
@@ -2,6 +2,7 @@ from .ImageToTextRequest import ImageToTextRequest
|
|
|
2
2
|
from .RecaptchaV2Request import RecaptchaV2Request
|
|
3
3
|
from .RecaptchaV2EnterpiseRequest import RecaptchaV2EnterpriseRequest
|
|
4
4
|
from .RecaptchaV3ProxylessRequest import RecaptchaV3ProxylessRequest
|
|
5
|
+
from .RecaptchaV3EnterpriseRequest import RecaptchaV3EnterpriseRequest
|
|
5
6
|
from .RecaptchaComplexImageTask import RecaptchaComplexImageTaskRequest
|
|
6
7
|
from .HcaptchaRequest import HcaptchaRequest
|
|
7
8
|
from .FuncaptchaRequest import FuncaptchaRequest
|
|
@@ -20,10 +21,13 @@ from .ImpervaCustomTaskRequest import ImpervaCustomTaskRequest
|
|
|
20
21
|
from .RecognitionComplexImageTaskRequest import RecognitionComplexImageTaskRequest
|
|
21
22
|
from .MTCaptchaRequest import MTCaptchaRequest
|
|
22
23
|
from .YidunRequest import YidunRequest
|
|
23
|
-
from .
|
|
24
|
+
from .ProsopoTaskRequest import ProsopoTaskRequest
|
|
25
|
+
from .TemuCustomTaskRequest import TemuCustomTaskRequest
|
|
26
|
+
from .AltchaCustomTaskRequest import AltchaCustomTaskRequest
|
|
27
|
+
from .proxy_info import ProxyInfo, ClientProxyInfo
|
|
24
28
|
|
|
25
29
|
|
|
26
|
-
REQUESTS = ['RecaptchaV2EnterpiseRequest', 'RecaptchaV2Request', 'RecaptchaV3ProxylessRequest', 'RecaptchaComplexImageTaskRequest'
|
|
30
|
+
REQUESTS = ['RecaptchaV2EnterpiseRequest', 'RecaptchaV2Request', 'RecaptchaV3ProxylessRequest', 'RecaptchaComplexImageTaskRequest', 'RecaptchaV3EnterpriseRequest'
|
|
27
31
|
'ImageToTextRequest',
|
|
28
32
|
'FuncaptchaRequest', 'FunCaptchaComplexImageTaskRequest',
|
|
29
33
|
'HcaptchaRequest', 'HcaptchaComplexImageTaskRequest'
|
|
@@ -35,4 +39,10 @@ REQUESTS = ['RecaptchaV2EnterpiseRequest', 'RecaptchaV2Request', 'RecaptchaV3Pro
|
|
|
35
39
|
'BinanceTaskRequest',
|
|
36
40
|
'ImpervaCustomTaskRequest',
|
|
37
41
|
'TurnstileRequest',
|
|
38
|
-
'RecognitionComplexImageTaskRequest'
|
|
42
|
+
'RecognitionComplexImageTaskRequest',
|
|
43
|
+
'MTCaptchaRequest',
|
|
44
|
+
'YidunRequest',
|
|
45
|
+
'ProsopoTaskRequest',
|
|
46
|
+
'TemuCustomTaskRequest',
|
|
47
|
+
'AltchaCustomTaskRequest'
|
|
48
|
+
]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from pydantic import BaseModel, validator
|
|
2
2
|
from .enums import ProxyTypes
|
|
3
|
+
from typing import Optional
|
|
3
4
|
|
|
4
5
|
class ProxyInfo(BaseModel):
|
|
5
6
|
proxyType: str
|
|
@@ -19,3 +20,22 @@ class ProxyInfo(BaseModel):
|
|
|
19
20
|
if not isinstance(value, int):
|
|
20
21
|
raise TypeError(f'Expect that port value will be <int> type, got {type(value)}')
|
|
21
22
|
return value
|
|
23
|
+
|
|
24
|
+
class ClientProxyInfo(BaseModel):
|
|
25
|
+
proxyType: str
|
|
26
|
+
proxyAddress: str
|
|
27
|
+
proxyPort: int
|
|
28
|
+
proxyLogin: Optional[str] = None
|
|
29
|
+
proxyPassword: Optional[str] = None
|
|
30
|
+
|
|
31
|
+
@validator('proxyType')
|
|
32
|
+
def validate_proxy_type(cls, value):
|
|
33
|
+
if value not in ProxyTypes.list_values():
|
|
34
|
+
raise ValueError(f'Expected that proxy type will be in {ProxyTypes.list_values()}, got "{value}"')
|
|
35
|
+
return value
|
|
36
|
+
|
|
37
|
+
@validator('proxyPort')
|
|
38
|
+
def validate_port(cls, value):
|
|
39
|
+
if not isinstance(value, int):
|
|
40
|
+
raise TypeError(f'Expect that port value will be <int> type, got {type(value)}')
|
|
41
|
+
return value
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.4.0
|
|
@@ -13,6 +13,7 @@ capmonstercloud_client/exceptions.py
|
|
|
13
13
|
capmonstercloud_client/requestController.py
|
|
14
14
|
capmonstercloud_client/utils.py
|
|
15
15
|
capmonstercloud_client/version.txt
|
|
16
|
+
capmonstercloud_client/requests/AltchaCustomTaskRequest.py
|
|
16
17
|
capmonstercloud_client/requests/AmazonWafRequest.py
|
|
17
18
|
capmonstercloud_client/requests/BasiliskCustomTaskRequest.py
|
|
18
19
|
capmonstercloud_client/requests/BinanceTaskRequest.py
|
|
@@ -27,11 +28,14 @@ capmonstercloud_client/requests/HcaptchaRequest.py
|
|
|
27
28
|
capmonstercloud_client/requests/ImageToTextRequest.py
|
|
28
29
|
capmonstercloud_client/requests/ImpervaCustomTaskRequest.py
|
|
29
30
|
capmonstercloud_client/requests/MTCaptchaRequest.py
|
|
31
|
+
capmonstercloud_client/requests/ProsopoTaskRequest.py
|
|
30
32
|
capmonstercloud_client/requests/RecaptchaComplexImageTask.py
|
|
31
33
|
capmonstercloud_client/requests/RecaptchaV2EnterpiseRequest.py
|
|
32
34
|
capmonstercloud_client/requests/RecaptchaV2Request.py
|
|
35
|
+
capmonstercloud_client/requests/RecaptchaV3EnterpriseRequest.py
|
|
33
36
|
capmonstercloud_client/requests/RecaptchaV3ProxylessRequest.py
|
|
34
37
|
capmonstercloud_client/requests/RecognitionComplexImageTaskRequest.py
|
|
38
|
+
capmonstercloud_client/requests/TemuCustomTaskRequest.py
|
|
35
39
|
capmonstercloud_client/requests/TenDiCustomTaskRequest.py
|
|
36
40
|
capmonstercloud_client/requests/TurnstileRequest.py
|
|
37
41
|
capmonstercloud_client/requests/YidunRequest.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.2.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/__init__.py
RENAMED
|
File without changes
|
{capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/captchaResult.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{capmonstercloudclient-3.2.0 → capmonstercloudclient-3.4.0}/capmonstercloud_client/requests/enums.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|