capmonstercloudclient 2.0.0__py3-none-any.whl → 3.0.0__py3-none-any.whl
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/CapMonsterCloudClient.py +34 -41
- capmonstercloudclient/requests/AmazonWafRequest.py +18 -11
- capmonstercloudclient/requests/BasiliskCustomTaskRequest.py +11 -9
- capmonstercloudclient/requests/BinanceTaskRequest.py +18 -11
- capmonstercloudclient/requests/CustomTaskRequestBase.py +3 -3
- capmonstercloudclient/requests/DataDomeCustomTaskRequest.py +9 -8
- capmonstercloudclient/requests/FuncaptchaRequest.py +15 -10
- capmonstercloudclient/requests/GeetestRequest.py +25 -10
- capmonstercloudclient/requests/HcaptchaRequest.py +16 -9
- capmonstercloudclient/requests/ImageToTextRequest.py +1 -1
- capmonstercloudclient/requests/ImpervaCustomTaskRequest.py +9 -8
- capmonstercloudclient/requests/RecaptchaComplexImageTask.py +1 -1
- capmonstercloudclient/requests/RecaptchaV2EnterpiseRequest.py +14 -10
- capmonstercloudclient/requests/RecaptchaV2Request.py +14 -9
- capmonstercloudclient/requests/RecognitionComplexImageTaskRequest.py +2 -2
- capmonstercloudclient/requests/TenDiCustomTaskRequest.py +12 -10
- capmonstercloudclient/requests/TurnstileRequest.py +43 -5
- capmonstercloudclient/requests/__init__.py +14 -21
- capmonstercloudclient/requests/baseRequest.py +2 -1
- capmonstercloudclient/requests/baseRequestWithProxy.py +7 -0
- capmonstercloudclient/version.txt +1 -1
- {capmonstercloudclient-2.0.0.dist-info → capmonstercloudclient-3.0.0.dist-info}/METADATA +1 -1
- capmonstercloudclient-3.0.0.dist-info/RECORD +39 -0
- capmonstercloudclient/requests/AmazonWafProxylessRequest.py +0 -22
- capmonstercloudclient/requests/AmazonWafRequestBase.py +0 -13
- capmonstercloudclient/requests/BasiliskCustomTaskProxylessRequest.py +0 -16
- capmonstercloudclient/requests/BasiliskCustomTaskRequestBase.py +0 -11
- capmonstercloudclient/requests/BinanceTaskProxylessRequest.py +0 -17
- capmonstercloudclient/requests/BinanceTaskRequestBase.py +0 -11
- capmonstercloudclient/requests/DataDomeCustomTaskProxylessRequest.py +0 -36
- capmonstercloudclient/requests/DataDomeCustomTaskRequestBase.py +0 -8
- capmonstercloudclient/requests/FuncaptchaProxylessRequest.py +0 -18
- capmonstercloudclient/requests/FuncaptchaRequestBase.py +0 -10
- capmonstercloudclient/requests/GeetestProxylessRequest.py +0 -31
- capmonstercloudclient/requests/GeetestRequestBase.py +0 -20
- capmonstercloudclient/requests/HcaptchaProxylessRequest.py +0 -25
- capmonstercloudclient/requests/HcaptchaRequestBase.py +0 -13
- capmonstercloudclient/requests/ImpervaCustomTaskProxylessRequest.py +0 -33
- capmonstercloudclient/requests/ImpervaCustomTaskRequestBase.py +0 -8
- capmonstercloudclient/requests/RecaptchaV2EnterpriseProxylessRequest.py +0 -18
- capmonstercloudclient/requests/RecaptchaV2EnterpriseRequestBase.py +0 -11
- capmonstercloudclient/requests/RecaptchaV2ProxylessRequest.py +0 -30
- capmonstercloudclient/requests/RecaptchaV2RequestBase.py +0 -12
- capmonstercloudclient/requests/TenDiCustomTaskProxylessRequest.py +0 -16
- capmonstercloudclient/requests/TenDiCustomTaskRequestBase.py +0 -11
- capmonstercloudclient/requests/TurnstileProxylessRequest.py +0 -10
- capmonstercloudclient/requests/TurnstileRequestBase.py +0 -47
- capmonstercloudclient-2.0.0.dist-info/RECORD +0 -62
- {capmonstercloudclient-2.0.0.dist-info → capmonstercloudclient-3.0.0.dist-info}/WHEEL +0 -0
- {capmonstercloudclient-2.0.0.dist-info → capmonstercloudclient-3.0.0.dist-info}/licenses/LICENSE +0 -0
- {capmonstercloudclient-2.0.0.dist-info → capmonstercloudclient-3.0.0.dist-info}/top_level.txt +0 -0
@@ -14,22 +14,22 @@ from .utils import parseVersion
|
|
14
14
|
|
15
15
|
|
16
16
|
_instance_config = (
|
17
|
-
((
|
18
|
-
((
|
17
|
+
((RecaptchaV2Request,), getRecaptchaV2Timeouts),
|
18
|
+
((RecaptchaV2EnterpriseRequest,), getRecaptchaV2EnterpriseTimeouts),
|
19
19
|
((RecaptchaV3ProxylessRequest), getRecaptchaV3Timeouts),
|
20
20
|
((ImageToTextRequest), getImage2TextTimeouts),
|
21
|
-
((
|
22
|
-
((
|
23
|
-
((
|
24
|
-
((
|
21
|
+
((FuncaptchaRequest,), getFuncaptchaTimeouts),
|
22
|
+
((HcaptchaRequest,), getHcaptchaTimeouts),
|
23
|
+
((GeetestRequest,), getGeetestTimeouts),
|
24
|
+
((TurnstileRequest,), getTurnstileTimeouts),
|
25
25
|
((RecaptchaComplexImageTaskRequest, HcaptchaComplexImageTaskRequest,
|
26
26
|
FunCaptchaComplexImageTaskRequest), getImage2TextTimeouts),
|
27
|
-
((DataDomeCustomTaskRequest,
|
28
|
-
((TenDiCustomTaskRequest,
|
29
|
-
((BasiliskCustomTaskRequest,
|
30
|
-
((AmazonWafRequest,
|
31
|
-
((BinanceTaskRequest,
|
32
|
-
((ImpervaCustomTaskRequest,
|
27
|
+
((DataDomeCustomTaskRequest,), getDatadomeTimeouts),
|
28
|
+
((TenDiCustomTaskRequest,), getTenDiTimeouts),
|
29
|
+
((BasiliskCustomTaskRequest,), getBasiliskTimeouts),
|
30
|
+
((AmazonWafRequest,), getAmazonWafTimeouts),
|
31
|
+
((BinanceTaskRequest,), getBinanceTimeouts),
|
32
|
+
((ImpervaCustomTaskRequest,), getImpervaTimeouts),
|
33
33
|
((RecognitionComplexImageTaskRequest), getCITTimeouts)
|
34
34
|
)
|
35
35
|
|
@@ -61,29 +61,24 @@ class CapMonsterClient:
|
|
61
61
|
return result
|
62
62
|
|
63
63
|
|
64
|
-
async def solve_captcha(self, request: Union[
|
64
|
+
async def solve_captcha(self, request: Union[
|
65
65
|
RecaptchaV2EnterpriseRequest,
|
66
66
|
RecaptchaV2Request,
|
67
|
-
RecaptchaV2ProxylessRequest,
|
68
67
|
RecaptchaV3ProxylessRequest,
|
69
|
-
ImageToTextRequest,
|
70
|
-
FuncaptchaProxylessRequest,
|
71
|
-
FuncaptchaRequest,
|
72
|
-
HcaptchaRequest,
|
73
|
-
HcaptchaProxylessRequest,
|
74
|
-
GeetestProxylessRequest,
|
75
|
-
GeetestRequest,
|
76
|
-
TurnstileProxylessRequest,
|
77
|
-
TurnstileRequest,
|
78
|
-
HcaptchaComplexImageTaskRequest,
|
79
68
|
RecaptchaComplexImageTaskRequest,
|
69
|
+
ImageToTextRequest,
|
70
|
+
FuncaptchaRequest,
|
80
71
|
FunCaptchaComplexImageTaskRequest,
|
81
|
-
|
72
|
+
HcaptchaRequest,
|
73
|
+
HcaptchaComplexImageTaskRequest,
|
74
|
+
GeetestRequest,
|
82
75
|
DataDomeCustomTaskRequest,
|
76
|
+
TenDiCustomTaskRequest,
|
77
|
+
BasiliskCustomTaskRequest,
|
78
|
+
AmazonWafRequest,
|
83
79
|
BinanceTaskRequest,
|
84
|
-
BinanceTaskProxylessRequest,
|
85
80
|
ImpervaCustomTaskRequest,
|
86
|
-
|
81
|
+
TurnstileRequest,
|
87
82
|
RecognitionComplexImageTaskRequest],
|
88
83
|
) -> Dict[str, str]:
|
89
84
|
'''
|
@@ -99,27 +94,25 @@ class CapMonsterClient:
|
|
99
94
|
raise UnknownRequestInstanceError(f'Unknown request instance "{type(request)}", ' \
|
100
95
|
f'expected that request will belong next instances: {rs_all}')
|
101
96
|
|
102
|
-
async def _solve(self, request: Union[
|
97
|
+
async def _solve(self, request: Union[
|
103
98
|
RecaptchaV2EnterpriseRequest,
|
104
99
|
RecaptchaV2Request,
|
105
|
-
RecaptchaV2ProxylessRequest,
|
106
100
|
RecaptchaV3ProxylessRequest,
|
107
|
-
ImageToTextRequest,
|
108
|
-
FuncaptchaProxylessRequest,
|
109
|
-
FuncaptchaRequest,
|
110
|
-
HcaptchaRequest,
|
111
|
-
HcaptchaProxylessRequest,
|
112
|
-
GeetestProxylessRequest,
|
113
|
-
GeetestRequest,
|
114
|
-
TurnstileProxylessRequest,
|
115
|
-
TurnstileRequest,
|
116
|
-
HcaptchaComplexImageTaskRequest,
|
117
101
|
RecaptchaComplexImageTaskRequest,
|
102
|
+
ImageToTextRequest,
|
103
|
+
FuncaptchaRequest,
|
118
104
|
FunCaptchaComplexImageTaskRequest,
|
105
|
+
HcaptchaRequest,
|
106
|
+
HcaptchaComplexImageTaskRequest,
|
107
|
+
GeetestRequest,
|
108
|
+
DataDomeCustomTaskRequest,
|
109
|
+
TenDiCustomTaskRequest,
|
110
|
+
BasiliskCustomTaskRequest,
|
111
|
+
AmazonWafRequest,
|
119
112
|
BinanceTaskRequest,
|
120
|
-
BinanceTaskProxylessRequest,
|
121
113
|
ImpervaCustomTaskRequest,
|
122
|
-
|
114
|
+
TurnstileRequest,
|
115
|
+
RecognitionComplexImageTaskRequest],
|
123
116
|
timeouts: GetResultTimeouts,
|
124
117
|
) -> Dict[str, str]:
|
125
118
|
|
@@ -1,11 +1,17 @@
|
|
1
|
-
from typing import Dict, Union
|
2
|
-
from pydantic import Field
|
1
|
+
from typing import Dict, Union, Optional
|
2
|
+
from pydantic import Field
|
3
3
|
|
4
|
-
from .
|
5
|
-
from .AmazonWafRequestBase import AmazonWafRequestBase
|
4
|
+
from .baseRequestWithProxy import BaseRequestWithProxy
|
6
5
|
|
7
|
-
class AmazonWafRequest(
|
6
|
+
class AmazonWafRequest(BaseRequestWithProxy):
|
8
7
|
type: str = 'AmazonTask'
|
8
|
+
websiteUrl: str
|
9
|
+
challengeScript: str
|
10
|
+
captchaScript: str
|
11
|
+
websiteKey: str
|
12
|
+
context: str
|
13
|
+
iv: str
|
14
|
+
cookieSolution: Optional[bool] = Field(default=None)
|
9
15
|
|
10
16
|
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
11
17
|
task = {}
|
@@ -16,12 +22,13 @@ class AmazonWafRequest(AmazonWafRequestBase, ProxyInfo):
|
|
16
22
|
task['websiteKey'] = self.websiteKey
|
17
23
|
task['context'] = self.context
|
18
24
|
task['iv'] = self.iv
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
+
|
26
|
+
if self.proxy:
|
27
|
+
task['proxyType'] = self.proxy.proxyType
|
28
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
29
|
+
task['proxyPort'] = self.proxy.proxyPort
|
30
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
31
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
25
32
|
|
26
33
|
if self.cookieSolution is not None:
|
27
34
|
task['cookieSolution'] = self.cookieSolution
|
@@ -1,10 +1,11 @@
|
|
1
1
|
from typing import Dict, Union
|
2
|
-
from pydantic import Field
|
2
|
+
from pydantic import Field
|
3
3
|
|
4
|
-
from .
|
5
|
-
from .BasiliskCustomTaskRequestBase import BasiliskCustomTaskRequestBase
|
4
|
+
from .CustomTaskRequestBase import CustomTaskRequestBase
|
6
5
|
|
7
|
-
class BasiliskCustomTaskRequest(
|
6
|
+
class BasiliskCustomTaskRequest(CustomTaskRequestBase):
|
7
|
+
captchaClass: str = Field(default='Basilisk')
|
8
|
+
websiteKey: str = Field()
|
8
9
|
|
9
10
|
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
10
11
|
task = {}
|
@@ -12,11 +13,12 @@ class BasiliskCustomTaskRequest(BasiliskCustomTaskRequestBase, ProxyInfo):
|
|
12
13
|
task['class'] = self.captchaClass
|
13
14
|
task['websiteURL'] = self.websiteUrl
|
14
15
|
task['websiteKey'] = self.websiteKey
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
20
22
|
if self.userAgent is not None:
|
21
23
|
task['userAgent'] = self.userAgent
|
22
24
|
return task
|
@@ -1,22 +1,29 @@
|
|
1
|
-
from typing import Dict, Union
|
2
|
-
from pydantic import Field
|
1
|
+
from typing import Dict, Union, Optional
|
2
|
+
from pydantic import Field
|
3
3
|
|
4
|
-
from .
|
5
|
-
|
4
|
+
from .baseRequestWithProxy import BaseRequestWithProxy
|
5
|
+
|
6
|
+
class BinanceTaskRequest(BaseRequestWithProxy):
|
7
|
+
type: str = Field(default='BinanceTask')
|
8
|
+
websiteKey: str = Field()
|
9
|
+
websiteUrl: str = Field()
|
10
|
+
validateId: str = Field()
|
11
|
+
userAgent: Optional[str] = None
|
6
12
|
|
7
|
-
class BinanceTaskRequest(BinanceTaskRequestBase, ProxyInfo):
|
8
|
-
|
9
13
|
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
10
14
|
task = {}
|
11
15
|
task['type'] = self.type
|
12
16
|
task['validateId'] = self.validateId
|
13
17
|
task['websiteURL'] = self.websiteUrl
|
14
18
|
task['websiteKey'] = self.websiteKey
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
19
|
+
|
20
|
+
if self.proxy:
|
21
|
+
task['proxyType'] = self.proxy.proxyType
|
22
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
23
|
+
task['proxyPort'] = self.proxy.proxyPort
|
24
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
25
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
26
|
+
|
20
27
|
if self.userAgent is not None:
|
21
28
|
task['userAgent'] = self.userAgent
|
22
29
|
return task
|
@@ -1,8 +1,8 @@
|
|
1
|
-
from typing import Optional, List
|
1
|
+
from typing import Optional, List
|
2
2
|
|
3
|
-
from .
|
3
|
+
from .baseRequestWithProxy import BaseRequestWithProxy
|
4
4
|
|
5
|
-
class CustomTaskRequestBase(
|
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
|
@@ -1,9 +1,9 @@
|
|
1
1
|
from typing import Dict, Union
|
2
2
|
from pydantic import Field, validator
|
3
|
-
from .
|
4
|
-
from .proxy_info import ProxyInfo
|
3
|
+
from .CustomTaskRequestBase import CustomTaskRequestBase
|
5
4
|
|
6
|
-
class DataDomeCustomTaskRequest(
|
5
|
+
class DataDomeCustomTaskRequest(CustomTaskRequestBase):
|
6
|
+
captchaClass: str = Field(default='DataDome')
|
7
7
|
metadata : Dict[str, str]
|
8
8
|
|
9
9
|
@validator('metadata')
|
@@ -28,11 +28,12 @@ class DataDomeCustomTaskRequest(DataDomeCustomTaskRequestBase, ProxyInfo):
|
|
28
28
|
task['type'] = self.type
|
29
29
|
task['class'] = self.captchaClass
|
30
30
|
task['websiteURL'] = self.websiteUrl
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
if self.proxy:
|
32
|
+
task['proxyType'] = self.proxy.proxyType
|
33
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
34
|
+
task['proxyPort'] = self.proxy.proxyPort
|
35
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
36
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
36
37
|
task['domains'] = self.domains
|
37
38
|
task['metadata'] = self.metadata
|
38
39
|
if self.userAgent is not None:
|
@@ -1,22 +1,27 @@
|
|
1
|
-
from typing import Dict, Union
|
1
|
+
from typing import Dict, Union, Optional
|
2
2
|
from pydantic import Field
|
3
3
|
|
4
|
-
from .
|
5
|
-
from .proxy_info import ProxyInfo
|
4
|
+
from .baseRequestWithProxy import BaseRequestWithProxy
|
6
5
|
|
7
|
-
class FuncaptchaRequest(
|
6
|
+
class FuncaptchaRequest(BaseRequestWithProxy):
|
8
7
|
type: str = Field(default='FunCaptchaTask')
|
9
|
-
|
8
|
+
websiteUrl: str
|
9
|
+
websitePublicKey: str
|
10
|
+
funcaptchaApiJSSubdomain: Optional[str] = Field(default=None)
|
11
|
+
data: Optional[str] = Field(default=None)
|
12
|
+
|
10
13
|
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
11
14
|
task = {}
|
12
15
|
task['type'] = self.type
|
13
16
|
task['websiteURL'] = self.websiteUrl
|
14
17
|
task['websitePublicKey'] = self.websitePublicKey
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
if self.proxy:
|
19
|
+
task['proxyType'] = self.proxy.proxyType
|
20
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
21
|
+
task['proxyPort'] = self.proxy.proxyPort
|
22
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
23
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
24
|
+
|
20
25
|
if self.funcaptchaApiJSSubdomain is not None:
|
21
26
|
task['funcaptchaApiJSSubdomain'] = self.funcaptchaApiJSSubdomain
|
22
27
|
if self.data is not None:
|
@@ -1,12 +1,26 @@
|
|
1
|
-
from pydantic import Field
|
2
|
-
from typing import Dict, Union
|
1
|
+
from pydantic import Field, validator
|
2
|
+
from typing import Dict, Union, Optional
|
3
3
|
|
4
|
-
from .
|
5
|
-
from .proxy_info import ProxyInfo
|
4
|
+
from .baseRequestWithProxy import BaseRequestWithProxy
|
6
5
|
|
7
|
-
|
6
|
+
|
7
|
+
class GeetestRequest(BaseRequestWithProxy):
|
8
8
|
type: str = Field(default='GeeTestTask')
|
9
|
+
websiteUrl: str
|
10
|
+
gt: str
|
11
|
+
challenge: Optional[str] = Field(default=None)
|
12
|
+
version: int = Field(default=3)
|
13
|
+
initParameters: Optional[Dict] = Field(default=None)
|
14
|
+
geetestApiServerSubdomain: Optional[str] = Field(default=None)
|
15
|
+
geetestGetLib: Optional[str] = Field(default=None)
|
16
|
+
user_agent: Optional[str] = Field(default=None)
|
9
17
|
|
18
|
+
@validator('version')
|
19
|
+
def validate_version(cls, value):
|
20
|
+
if value not in [3, 4]:
|
21
|
+
raise ValueError(f"Geetest version could be 3 or 4, not {value}")
|
22
|
+
return value
|
23
|
+
|
10
24
|
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
11
25
|
task = {}
|
12
26
|
task['type'] = self.type
|
@@ -30,9 +44,10 @@ class GeetestRequest(GeetestRequestBase, ProxyInfo):
|
|
30
44
|
if self.user_agent is not None:
|
31
45
|
task['userAgent'] = self.user_agent
|
32
46
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
47
|
+
if self.proxy:
|
48
|
+
task['proxyType'] = self.proxy.proxyType
|
49
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
50
|
+
task['proxyPort'] = self.proxy.proxyPort
|
51
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
52
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
38
53
|
return task
|
@@ -1,11 +1,17 @@
|
|
1
1
|
from pydantic import Field
|
2
|
-
from typing import Dict, Union
|
2
|
+
from typing import Dict, Union, Optional
|
3
3
|
|
4
|
-
from .
|
5
|
-
from .proxy_info import ProxyInfo
|
4
|
+
from .baseRequestWithProxy import BaseRequestWithProxy
|
6
5
|
|
7
|
-
class HcaptchaRequest(
|
6
|
+
class HcaptchaRequest(BaseRequestWithProxy):
|
8
7
|
type: str = Field(default='HCaptchaTask')
|
8
|
+
websiteUrl: str
|
9
|
+
websiteKey: str
|
10
|
+
is_invisible: Optional[bool] = Field(default=None)
|
11
|
+
data: Optional[str] = Field(default=None)
|
12
|
+
user_agent: Optional[str] = Field(default=None)
|
13
|
+
cookies: Optional[str] = Field(default=None)
|
14
|
+
fallbackToActualUA: Optional[bool] = Field(default=None)
|
9
15
|
|
10
16
|
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
11
17
|
|
@@ -13,11 +19,12 @@ class HcaptchaRequest(HcaptchaRequestBase, ProxyInfo):
|
|
13
19
|
task['type'] = self.type
|
14
20
|
task['websiteURL'] = self.websiteUrl
|
15
21
|
task['websiteKey'] = self.websiteKey
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
22
|
+
if self.proxy:
|
23
|
+
task['proxyType'] = self.proxy.proxyType
|
24
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
25
|
+
task['proxyPort'] = self.proxy.proxyPort
|
26
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
27
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
21
28
|
if self.is_invisible is not None:
|
22
29
|
task['isInvisible'] = self.is_invisible
|
23
30
|
if self.data is not None:
|
@@ -1,10 +1,10 @@
|
|
1
1
|
from typing import Dict, Union
|
2
2
|
from pydantic import Field, validator
|
3
3
|
|
4
|
-
from .
|
5
|
-
from .ImpervaCustomTaskRequestBase import ImpervaCustomTaskRequestBase
|
4
|
+
from .CustomTaskRequestBase import CustomTaskRequestBase
|
6
5
|
|
7
|
-
class ImpervaCustomTaskRequest(
|
6
|
+
class ImpervaCustomTaskRequest(CustomTaskRequestBase):
|
7
|
+
captchaClass: str = Field(default='Imperva')
|
8
8
|
metadata : Dict[str, str]
|
9
9
|
|
10
10
|
@validator('metadata')
|
@@ -29,11 +29,12 @@ class ImpervaCustomTaskRequest(ImpervaCustomTaskRequestBase, ProxyInfo):
|
|
29
29
|
task['class'] = self.captchaClass
|
30
30
|
task['websiteURL'] = self.websiteUrl
|
31
31
|
task['metadata'] = self.metadata
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
if self.proxy:
|
33
|
+
task['proxyType'] = self.proxy.proxyType
|
34
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
35
|
+
task['proxyPort'] = self.proxy.proxyPort
|
36
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
37
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
37
38
|
if self.userAgent is not None:
|
38
39
|
task['userAgent'] = self.userAgent
|
39
40
|
return task
|
@@ -1,22 +1,26 @@
|
|
1
|
-
from typing import Dict, Union
|
1
|
+
from typing import Dict, Union, Optional
|
2
2
|
from pydantic import Field
|
3
3
|
|
4
|
-
from .
|
5
|
-
from .proxy_info import ProxyInfo
|
4
|
+
from .baseRequestWithProxy import BaseRequestWithProxy
|
6
5
|
|
7
|
-
class RecaptchaV2EnterpriseRequest(
|
6
|
+
class RecaptchaV2EnterpriseRequest(BaseRequestWithProxy):
|
8
7
|
type: str = Field(default='RecaptchaV2EnterpriseTask')
|
9
|
-
|
8
|
+
websiteUrl: str
|
9
|
+
websiteKey: str
|
10
|
+
enterprisePayload: Optional[str] = Field(default=None)
|
11
|
+
apiDomain: Optional[str] = Field(default=None)
|
12
|
+
|
10
13
|
def getTaskDict(self) -> Dict[str, Union[str, int]]:
|
11
14
|
task = {}
|
12
15
|
task['type'] = self.type
|
13
16
|
task['websiteURL'] = self.websiteUrl
|
14
17
|
task['websiteKey'] = self.websiteKey
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
if self.proxy:
|
19
|
+
task['proxyType'] = self.proxy.proxyType
|
20
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
21
|
+
task['proxyPort'] = self.proxy.proxyPort
|
22
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
23
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
20
24
|
if self.enterprisePayload is not None:
|
21
25
|
task['enterprisePayload'] = {'s': self.enterprisePayload}
|
22
26
|
if self.apiDomain is not None:
|
@@ -1,23 +1,28 @@
|
|
1
|
-
from typing import Dict, Union
|
1
|
+
from typing import Dict, Union, Optional
|
2
2
|
from pydantic import Field
|
3
|
-
from .
|
4
|
-
from .proxy_info import ProxyInfo
|
3
|
+
from .baseRequestWithProxy import BaseRequestWithProxy
|
5
4
|
|
6
5
|
|
7
|
-
class RecaptchaV2Request(
|
6
|
+
class RecaptchaV2Request(BaseRequestWithProxy):
|
8
7
|
|
9
8
|
type: str = Field(default="NoCaptchaTask")
|
9
|
+
websiteUrl: str
|
10
|
+
websiteKey: str
|
11
|
+
dataSValue: Optional[str] = Field(default=None)
|
12
|
+
userAgent: Optional[str] = Field(default=None)
|
13
|
+
cookies: Optional[str] = Field(default=None)
|
10
14
|
|
11
15
|
def getTaskDict(self) -> Dict[str, Union[str, int]]:
|
12
16
|
task = {}
|
13
17
|
task['type'] = self.type
|
14
18
|
task['websiteURL'] = self.websiteUrl
|
15
19
|
task['websiteKey'] = self.websiteKey
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
20
|
+
if self.proxy:
|
21
|
+
task['proxyType'] = self.proxy.proxyType
|
22
|
+
task['proxyAddress'] = self.proxy.proxyAddress
|
23
|
+
task['proxyPort'] = self.proxy.proxyPort
|
24
|
+
task['proxyLogin'] = self.proxy.proxyLogin
|
25
|
+
task['proxyPassword'] = self.proxy.proxyPassword
|
21
26
|
|
22
27
|
if self.dataSValue is not None:
|
23
28
|
task['recaptchaDataSValue'] = self.dataSValue
|
@@ -1,7 +1,7 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Dict, Union
|
2
2
|
from pydantic import validator
|
3
3
|
from .ComplexImageTaskBase import ComplexImageTaskRequestBase
|
4
|
-
from ..exceptions import
|
4
|
+
from ..exceptions import ZeroImagesErrors, TaskNotDefinedError
|
5
5
|
|
6
6
|
|
7
7
|
class RecognitionComplexImageTaskRequest(ComplexImageTaskRequestBase):
|
@@ -1,22 +1,24 @@
|
|
1
1
|
from typing import Dict, Union
|
2
|
-
from pydantic import Field
|
2
|
+
from pydantic import Field
|
3
3
|
|
4
|
-
from .
|
5
|
-
|
4
|
+
from .CustomTaskRequestBase import CustomTaskRequestBase
|
5
|
+
|
6
|
+
class TenDiCustomTaskRequest(CustomTaskRequestBase):
|
7
|
+
captchaClass: str = Field(default='TenDI')
|
8
|
+
websiteKey: str = Field()
|
6
9
|
|
7
|
-
class TenDiCustomTaskRequest(TenDiCustomTaskRequestBase, ProxyInfo):
|
8
|
-
|
9
10
|
def getTaskDict(self) -> Dict[str, Union[str, int, bool]]:
|
10
11
|
task = {}
|
11
12
|
task['type'] = self.type
|
12
13
|
task['class'] = self.captchaClass
|
13
14
|
task['websiteURL'] = self.websiteUrl
|
14
15
|
task['websiteKey'] = self.websiteKey
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
20
22
|
if self.userAgent is not None:
|
21
23
|
task['userAgent'] = self.userAgent
|
22
24
|
return task
|
@@ -1,13 +1,51 @@
|
|
1
|
-
from typing import Dict
|
2
|
-
from pydantic import Field
|
3
|
-
from .
|
4
|
-
from .proxy_info import ProxyInfo
|
1
|
+
from typing import Dict, Optional
|
2
|
+
from pydantic import Field, validator, model_validator
|
3
|
+
from .baseRequestWithProxy import BaseRequestWithProxy
|
5
4
|
|
6
5
|
|
7
|
-
class TurnstileRequest(
|
6
|
+
class TurnstileRequest(BaseRequestWithProxy):
|
8
7
|
|
9
8
|
type: str = Field(default="TurnstileTask")
|
9
|
+
websiteURL: str
|
10
|
+
websiteKey: str
|
11
|
+
pageAction: Optional[str] = Field(default=None)
|
12
|
+
data: Optional[str] = Field(default=None)
|
13
|
+
pageData: Optional[str] = Field(default=None)
|
14
|
+
userAgent: Optional[str] = Field(default=None)
|
15
|
+
cloudflareTaskType: Optional[str] = Field(default=None)
|
16
|
+
htmlPageBase64: Optional[str] = Field(default=None)
|
17
|
+
apiJsUrl: Optional[str] = Field(default=None)
|
10
18
|
|
19
|
+
@validator('cloudflareTaskType')
|
20
|
+
def validate_cloudflare_task(cls, value):
|
21
|
+
if value is not None:
|
22
|
+
if value not in ['cf_clearance', 'token']:
|
23
|
+
raise ValueError(f'cloudflareTaskType could be "cf_clearance" if you need cookie or ' \
|
24
|
+
f'"token" if required token from Turnstile.')
|
25
|
+
return value
|
26
|
+
|
27
|
+
@model_validator(mode='before')
|
28
|
+
def validate_cloudflare_type_token(self):
|
29
|
+
|
30
|
+
if self.get('htmlPageBase64') is None:
|
31
|
+
if self.get('cloudflareTaskType') == 'cf_clearance':
|
32
|
+
raise RuntimeError(f'Expect that "htmlPageBase64" will be filled ' \
|
33
|
+
f'when cloudflareTaskType is "cf_clearance"')
|
34
|
+
|
35
|
+
if self.get('cloudflareTaskType') == 'token':
|
36
|
+
for field in ['pageAction', 'pageData', 'data']:
|
37
|
+
if self.get(field) is None:
|
38
|
+
raise RuntimeError(f'Expect that "{field}" will be filled ' \
|
39
|
+
f'when "cloudflareTaskType" = "token".')
|
40
|
+
|
41
|
+
if self.get('cloudflareTaskType') is not None:
|
42
|
+
if self.get('cloudflareTaskType') in ['cf_clearance', 'token']:
|
43
|
+
if self.get('userAgent') is None:
|
44
|
+
raise RuntimeError(f'Expect that userAgent will be filled ' \
|
45
|
+
f'when cloudflareTaskType specified.')
|
46
|
+
|
47
|
+
return self
|
48
|
+
|
11
49
|
def getTaskDict(self) -> Dict[str, str]:
|
12
50
|
return {k: v for k, v in self.model_dump().items() if v is not None}
|
13
51
|
|