capmonster-python 3.2.0__py3-none-any.whl → 5.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.
- capmonster_python/__init__.py +47 -13
- capmonster_python/client.py +363 -0
- capmonster_python/exceptions.py +60 -0
- capmonster_python/methods.py +37 -0
- capmonster_python/tasks/__init__.py +66 -0
- capmonster_python/tasks/altcha.py +48 -0
- capmonster_python/tasks/amazon.py +54 -0
- capmonster_python/tasks/basilisk.py +24 -0
- capmonster_python/tasks/binance.py +31 -0
- capmonster_python/tasks/castle.py +46 -0
- capmonster_python/tasks/complex_image_recaptcha.py +73 -0
- capmonster_python/tasks/complex_image_recognition.py +33 -0
- capmonster_python/tasks/datadome.py +62 -0
- capmonster_python/tasks/funcaptcha.py +40 -0
- capmonster_python/tasks/geetest.py +86 -0
- capmonster_python/tasks/hunt.py +27 -0
- capmonster_python/tasks/image_to_text.py +37 -0
- capmonster_python/tasks/imperva.py +50 -0
- capmonster_python/tasks/mtcaptcha.py +36 -0
- capmonster_python/tasks/prosopo.py +27 -0
- capmonster_python/tasks/recaptcha_click.py +31 -0
- capmonster_python/tasks/recaptcha_v2.py +44 -0
- capmonster_python/tasks/recaptcha_v2_enterprise.py +44 -0
- capmonster_python/tasks/recaptcha_v3.py +34 -0
- capmonster_python/tasks/recaptcha_v3_enterprise.py +30 -0
- capmonster_python/tasks/task.py +146 -0
- capmonster_python/tasks/temu.py +32 -0
- capmonster_python/tasks/tendi.py +30 -0
- capmonster_python/tasks/tspd.py +44 -0
- capmonster_python/tasks/turnstile.py +111 -0
- capmonster_python/tasks/yidun.py +49 -0
- capmonster_python-5.0.0.dist-info/METADATA +232 -0
- capmonster_python-5.0.0.dist-info/RECORD +36 -0
- {capmonster_python-3.2.0.dist-info → capmonster_python-5.0.0.dist-info}/WHEEL +1 -1
- capmonster_python/aws_waf.py +0 -22
- capmonster_python/capmonster.py +0 -253
- capmonster_python/compleximage.py +0 -51
- capmonster_python/datadome.py +0 -19
- capmonster_python/fun_captcha.py +0 -30
- capmonster_python/geetest.py +0 -26
- capmonster_python/hcaptcha.py +0 -36
- capmonster_python/image_to_text.py +0 -43
- capmonster_python/recaptcha_v2.py +0 -27
- capmonster_python/recaptcha_v2_enterprise.py +0 -30
- capmonster_python/recaptcha_v3.py +0 -24
- capmonster_python/tendi.py +0 -19
- capmonster_python/turnstile.py +0 -23
- capmonster_python/utils.py +0 -35
- capmonster_python-3.2.0.dist-info/METADATA +0 -120
- capmonster_python-3.2.0.dist-info/RECORD +0 -20
- {capmonster_python-3.2.0.dist-info → capmonster_python-5.0.0.dist-info/licenses}/LICENSE +0 -0
- {capmonster_python-3.2.0.dist-info → capmonster_python-5.0.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from typing import Any, Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload, ProxyPayload, UserAgentPayload
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class AmazonTask(TaskPayload, UserAgentPayload):
|
|
9
|
+
"""
|
|
10
|
+
Represents a task for solving Amazon AWS WAF captcha and challenge.
|
|
11
|
+
|
|
12
|
+
Supports multiple solving options:
|
|
13
|
+
- Option 1: websiteURL + websiteKey + captchaScript (simple captcha)
|
|
14
|
+
- Option 2: websiteURL + websiteKey + challengeScript + context + iv (full challenge)
|
|
15
|
+
- Option 3: websiteURL + challengeScript (invisible challenge only)
|
|
16
|
+
|
|
17
|
+
Attributes:
|
|
18
|
+
websiteURL: The main page address where the captcha is solved.
|
|
19
|
+
websiteKey: Found in the apiKey field when rendering captcha.
|
|
20
|
+
captchaScript: Link to jsapi.js or captcha.js on the HTML page.
|
|
21
|
+
challengeScript: Link to challenge.js.
|
|
22
|
+
context: Obtained from window.gokuProps.context.
|
|
23
|
+
iv: Obtained from window.gokuProps.iv.
|
|
24
|
+
cookieSolution: If true, returns aws-waf-token cookie instead of voucher/token.
|
|
25
|
+
proxy: Optional proxy settings.
|
|
26
|
+
"""
|
|
27
|
+
type: str = Field(default="AmazonTask", frozen=True)
|
|
28
|
+
websiteURL: str = Field(..., description='The main page address where the captcha is solved.')
|
|
29
|
+
websiteKey: Optional[str] = Field(
|
|
30
|
+
default=None,
|
|
31
|
+
description='Can be found in the apiKey field when rendering captcha.')
|
|
32
|
+
captchaScript: Optional[str] = Field(
|
|
33
|
+
default=None,
|
|
34
|
+
description='Link to jsapi.js or captcha.js on the HTML page.')
|
|
35
|
+
challengeScript: Optional[str] = Field(
|
|
36
|
+
default=None,
|
|
37
|
+
description='Link to challenge.js.')
|
|
38
|
+
context: Optional[str] = Field(
|
|
39
|
+
default=None,
|
|
40
|
+
description='Obtained from window.gokuProps.context.')
|
|
41
|
+
iv: Optional[str] = Field(
|
|
42
|
+
default=None,
|
|
43
|
+
description='Obtained from window.gokuProps.iv.')
|
|
44
|
+
cookieSolution: Optional[bool] = Field(
|
|
45
|
+
default=None,
|
|
46
|
+
description='If true, returns aws-waf-token cookie instead of captcha_voucher and existing_token.')
|
|
47
|
+
proxy: Optional[ProxyPayload] = Field(default=None, description='Proxy settings.')
|
|
48
|
+
|
|
49
|
+
def to_request(self) -> dict[str, Any]:
|
|
50
|
+
base = self.model_dump(exclude_none=True)
|
|
51
|
+
proxy_dict = base.pop("proxy", {})
|
|
52
|
+
if proxy_dict:
|
|
53
|
+
base.update(proxy_dict)
|
|
54
|
+
return base
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload, UserAgentPayload
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class BasiliskTask(TaskPayload, UserAgentPayload):
|
|
9
|
+
"""
|
|
10
|
+
BasiliskTask represents a specific task payload used for solving captcha on a given website.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
websiteURL (str): The address of the main page where the captcha is solved.
|
|
14
|
+
websiteKey (str): Can be found in the html code in the attribute data-sitekey of the captcha container or in
|
|
15
|
+
the payload of a POST request to the https://basiliskcaptcha.com/challenge/check-site in the field site_key.
|
|
16
|
+
"""
|
|
17
|
+
type: str = Field(default="CustomTask", frozen=True)
|
|
18
|
+
class_: str = Field(default="Basilisk", alias="class", frozen=True)
|
|
19
|
+
websiteURL: str = Field(..., description="The address of the main page where the captcha is solved.")
|
|
20
|
+
websiteKey: str = Field(...,
|
|
21
|
+
description="Can be found in the html code in the attribute data-sitekey of the captcha container.")
|
|
22
|
+
|
|
23
|
+
def to_request(self) -> dict[str, Any]:
|
|
24
|
+
return self.model_dump(exclude_none=True, by_alias=True)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from typing import Optional, Any
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload, UserAgentPayload, ProxyPayload
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class BinanceTask(TaskPayload, UserAgentPayload):
|
|
9
|
+
"""
|
|
10
|
+
Represents a Binance task to solve captcha challenges with a specific payload. Use only to log in with your account.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
websiteURL: The address of the main page where the captcha is solved.
|
|
14
|
+
websiteKey: A unique parameter for your website's section.
|
|
15
|
+
validateId: A dynamic key representing the value of the parameter validateId, securityId, or
|
|
16
|
+
securityCheckResponseValidateId.
|
|
17
|
+
proxy: Optional proxy settings used for handling requests during captcha solving.
|
|
18
|
+
"""
|
|
19
|
+
type: str = Field(default="BinanceTask", frozen=True)
|
|
20
|
+
websiteURL: str = Field(..., description="The address of the main page where the captcha is solved.")
|
|
21
|
+
websiteKey: str = Field(..., description="A unique parameter for your website's section.")
|
|
22
|
+
validateId: str = Field(..., description="A dynamic key. The value of the parameter validateId, securityId, "
|
|
23
|
+
"or securityCheckResponseValidateId.")
|
|
24
|
+
proxy: Optional[ProxyPayload] = Field(default=None, description="Proxy settings.")
|
|
25
|
+
|
|
26
|
+
def to_request(self) -> dict[str, Any]:
|
|
27
|
+
base = self.model_dump(exclude_none=True, by_alias=True)
|
|
28
|
+
proxy_dict = base.pop("proxy", {})
|
|
29
|
+
if proxy_dict:
|
|
30
|
+
base.update(proxy_dict)
|
|
31
|
+
return base
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from typing import Any, Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import Field, BaseModel
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload, ProxyPayload, UserAgentPayload
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CastleMetadata(BaseModel):
|
|
9
|
+
"""
|
|
10
|
+
Metadata for Castle task.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
wUrl: Link to cw.js file.
|
|
14
|
+
swUrl: Link to csw.js file.
|
|
15
|
+
count: Number of tokens to generate (default 1, max 49).
|
|
16
|
+
"""
|
|
17
|
+
wUrl: str = Field(..., description='Link to cw.js file.')
|
|
18
|
+
swUrl: str = Field(..., description='Link to csw.js file.')
|
|
19
|
+
count: Optional[int] = Field(default=None, description='Number of tokens (default 1, max 49).', ge=1, le=49)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class CastleTask(TaskPayload, UserAgentPayload):
|
|
23
|
+
"""
|
|
24
|
+
Represents a task for solving Castle challenges.
|
|
25
|
+
|
|
26
|
+
Uses CustomTask type with class "Castle".
|
|
27
|
+
|
|
28
|
+
Attributes:
|
|
29
|
+
websiteURL: URL of the page where Castle is located.
|
|
30
|
+
websiteKey: Publishable Key.
|
|
31
|
+
metadata: Castle-specific metadata (wUrl, swUrl, count).
|
|
32
|
+
proxy: Optional proxy settings.
|
|
33
|
+
"""
|
|
34
|
+
type: str = Field(default="CustomTask", frozen=True)
|
|
35
|
+
class_: str = Field(default="Castle", alias="class", frozen=True)
|
|
36
|
+
websiteURL: str = Field(..., description='URL of the page where Castle is located.')
|
|
37
|
+
websiteKey: str = Field(..., description='Castle publishable key.')
|
|
38
|
+
metadata: CastleMetadata = Field(..., description='Castle-specific metadata.')
|
|
39
|
+
proxy: Optional[ProxyPayload] = Field(default=None, description='Proxy settings.')
|
|
40
|
+
|
|
41
|
+
def to_request(self) -> dict[str, Any]:
|
|
42
|
+
base = self.model_dump(exclude_none=True, by_alias=True)
|
|
43
|
+
proxy_dict = base.pop("proxy", {})
|
|
44
|
+
if proxy_dict:
|
|
45
|
+
base.update(proxy_dict)
|
|
46
|
+
return base
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from typing import List, Literal, Optional, Any
|
|
2
|
+
|
|
3
|
+
from pydantic import Field, BaseModel, model_validator
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload
|
|
6
|
+
from ..exceptions import CapmonsterValidationException
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ComplexImageRecaptchaMetadata(BaseModel):
|
|
10
|
+
"""
|
|
11
|
+
Represents metadata for a complex image-based CAPTCHA task.
|
|
12
|
+
|
|
13
|
+
Attributes:
|
|
14
|
+
task: Optional. Represents the textual description of the CAPTCHA task
|
|
15
|
+
(e.g., "Click on traffic lights"). Only one of `task` or `taskDefinition`
|
|
16
|
+
must be set.
|
|
17
|
+
taskDefinition: Optional. Represents the technical value defining the CAPTCHA
|
|
18
|
+
task type. Only one of `task` or `taskDefinition` must be set.
|
|
19
|
+
grid: Required. Specifies the grid size of the CAPTCHA. It must be one of
|
|
20
|
+
the possible values: "4x4", "3x3", or "1x1".
|
|
21
|
+
"""
|
|
22
|
+
task: Optional[str] = Field(default=None, alias="Task",
|
|
23
|
+
description="Possible values: \"Click on traffic lights\" and others.")
|
|
24
|
+
taskDefinition: Optional[str] = Field(default=None, alias="TaskDefinition",
|
|
25
|
+
description="Technical value that defines the task type.")
|
|
26
|
+
grid: Literal["4x4", "3x3", "1x1"] = Field(..., alias="Grid",
|
|
27
|
+
description="Grid size of the captcha part.")
|
|
28
|
+
|
|
29
|
+
@model_validator(mode="after")
|
|
30
|
+
def check_fields_match_type(self) -> "ComplexImageRecaptchaMetadata":
|
|
31
|
+
if self.task is None and self.taskDefinition is None:
|
|
32
|
+
raise ValueError("task or taskDefinition must be set")
|
|
33
|
+
if self.task is not None and self.taskDefinition is not None:
|
|
34
|
+
raise ValueError("only one of task or taskDefinition must be set")
|
|
35
|
+
return self
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class ComplexImageRecaptchaTask(TaskPayload):
|
|
39
|
+
"""
|
|
40
|
+
Represents a task payload for solving complex image-based recaptcha challenges.
|
|
41
|
+
|
|
42
|
+
Attributes:
|
|
43
|
+
imageUrls: Optional list of image URLs associated with the captcha. These may
|
|
44
|
+
correspond to a single image captcha of formats 4x4, 3x3, or other new
|
|
45
|
+
configurations.
|
|
46
|
+
imagesBase64: Optional list of base64-encoded images. Similar to imageUrls,
|
|
47
|
+
these represent segments of the captcha in various formats such as 4x4,
|
|
48
|
+
3x3, or others.
|
|
49
|
+
metadata: Metadata describing additional details required for solving the recaptcha
|
|
50
|
+
challenge. This attribute must be provided.
|
|
51
|
+
|
|
52
|
+
Raises:
|
|
53
|
+
CapmonsterValidationException: If neither `imageUrls` nor `imagesBase64` is provided,
|
|
54
|
+
or if both are provided at the same time.
|
|
55
|
+
"""
|
|
56
|
+
type: str = Field(default="ComplexImageTask", frozen=True)
|
|
57
|
+
class_: str = Field(default="recaptcha", alias="class", frozen=True)
|
|
58
|
+
imageUrls: Optional[List[str]] = Field(default=None,
|
|
59
|
+
description="Single image 4x4, 3x3 or a new 1x1 captcha part (in an array).")
|
|
60
|
+
imagesBase64: Optional[List[str]] = Field(default=None,
|
|
61
|
+
description="Single image 4x4, 3x3 or a new 1x1 captcha part in base64 format (in an array).")
|
|
62
|
+
metadata: ComplexImageRecaptchaMetadata = Field(..., description="Metadata for the task.")
|
|
63
|
+
|
|
64
|
+
@model_validator(mode="after")
|
|
65
|
+
def check_fields_match_type(self) -> "ComplexImageRecaptchaTask":
|
|
66
|
+
if self.imageUrls is None and self.imagesBase64 is None:
|
|
67
|
+
raise CapmonsterValidationException("imageUrls or imagesBase64 must be set")
|
|
68
|
+
if self.imageUrls is not None and self.imagesBase64 is not None:
|
|
69
|
+
raise CapmonsterValidationException("only one of imageUrls or imagesBase64 must be set")
|
|
70
|
+
return self
|
|
71
|
+
|
|
72
|
+
def to_request(self) -> dict[str, Any]:
|
|
73
|
+
return self.model_dump(exclude_none=True, by_alias=True)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from typing import List, Literal, Any
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ComplexImageRecognitionTask(TaskPayload):
|
|
9
|
+
"""
|
|
10
|
+
Represents a complex image recognition task payload.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
imagesBase64: List of base64 encoded images. This is required and contains
|
|
14
|
+
raw image data in base64 format.
|
|
15
|
+
task: A string indicating one of the predefined types of recognition
|
|
16
|
+
task. This must be one of "oocl_rotate_new", "oocl_rotate_double_new",
|
|
17
|
+
"betpunch_3x3_rotate", "bls", "shein".
|
|
18
|
+
"""
|
|
19
|
+
type: str = Field(default="ComplexImageTask", frozen=True)
|
|
20
|
+
class_: str = Field(default="recognition", alias="class", frozen=True)
|
|
21
|
+
imagesBase64: List[str] = Field(..., description="List of base64 encoded images.")
|
|
22
|
+
task: Literal["oocl_rotate_new", "oocl_rotate_double_new", "betpunch_3x3_rotate", "bls", "shein"] = Field(...,
|
|
23
|
+
description="Type of task.")
|
|
24
|
+
|
|
25
|
+
def to_request(self) -> dict[str, Any]:
|
|
26
|
+
base = self.model_dump(exclude_none=True, by_alias=True)
|
|
27
|
+
task = base.pop("task")
|
|
28
|
+
|
|
29
|
+
if "metadata" not in base:
|
|
30
|
+
base["metadata"] = {}
|
|
31
|
+
|
|
32
|
+
base["metadata"]["Task"] = task
|
|
33
|
+
return base
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from typing import Optional, Any
|
|
2
|
+
|
|
3
|
+
from pydantic import Field, BaseModel, model_validator
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload, UserAgentPayload, ProxyPayload
|
|
6
|
+
from ..exceptions import CapmonsterValidationException
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class DataDomeMetadata(BaseModel):
|
|
10
|
+
"""
|
|
11
|
+
Represents metadata related to DataDome.
|
|
12
|
+
|
|
13
|
+
Attributes:
|
|
14
|
+
htmlPageBase64: Optional; Contains additional data about the captcha in
|
|
15
|
+
Base64-encoded format.
|
|
16
|
+
captchaUrl: Optional; URL pointing to the captcha, typically formatted
|
|
17
|
+
like: "https://geo.captcha-delivery.com/captcha/?initialCid=...".
|
|
18
|
+
datadomeCookie: Mandatory; Stores the DataDome cookies, retrievable on
|
|
19
|
+
the page using `document.cookie`.
|
|
20
|
+
|
|
21
|
+
Raises:
|
|
22
|
+
CapmonsterValidationException: If neither `htmlPageBase64` nor `captchaUrl` is provided,
|
|
23
|
+
or if both are provided at the same time.
|
|
24
|
+
"""
|
|
25
|
+
htmlPageBase64: Optional[str] = Field(default=None,
|
|
26
|
+
description="Object that contains additional data about the captcha.")
|
|
27
|
+
captchaUrl: Optional[str] = Field(default=None,
|
|
28
|
+
description="\"captchaUrl\" - link to the captcha. Usually it looks like this: \"https://geo.captcha-delivery.com/captcha/?initialCid=...\"")
|
|
29
|
+
datadomeCookie: str = Field(...,
|
|
30
|
+
description="Your cookies from datadome. You can get it on the page using document.cookie")
|
|
31
|
+
|
|
32
|
+
@model_validator(mode="after")
|
|
33
|
+
def validate_fields(self) -> "DataDomeMetadata":
|
|
34
|
+
if self.htmlPageBase64 is None and self.captchaUrl is None:
|
|
35
|
+
raise CapmonsterValidationException("htmlPageBase64 or captchaUrl required.")
|
|
36
|
+
if self.htmlPageBase64 is not None and self.captchaUrl is not None:
|
|
37
|
+
raise CapmonsterValidationException("htmlPageBase64 and captchaUrl are mutually exclusive.")
|
|
38
|
+
return self
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class DataDomeTask(TaskPayload, UserAgentPayload):
|
|
42
|
+
"""
|
|
43
|
+
Represents a task payload for solving captchas on the DataDome platform.
|
|
44
|
+
|
|
45
|
+
Attributes:
|
|
46
|
+
websiteURL: A string that contains the address of the page where the captcha is solved.
|
|
47
|
+
proxy: Optional proxy settings, represented as a ProxyPayload. Defaults to None.
|
|
48
|
+
metadata: Additional metadata about the captcha, represented as a DataDomeMetadata.
|
|
49
|
+
Defaults to None.
|
|
50
|
+
"""
|
|
51
|
+
type: str = Field(default="CustomTask", frozen=True)
|
|
52
|
+
class_: str = Field(default="DataDome", alias="class", frozen=True)
|
|
53
|
+
websiteURL: str = Field(..., description="Address of the page on which the captcha is solved.")
|
|
54
|
+
proxy: Optional[ProxyPayload] = Field(default=None, description="Proxy settings.")
|
|
55
|
+
metadata: DataDomeMetadata = Field(default=None, description="Additional data about the captcha.")
|
|
56
|
+
|
|
57
|
+
def to_request(self) -> dict[str, Any]:
|
|
58
|
+
base = self.model_dump(exclude_none=True, by_alias=True)
|
|
59
|
+
proxy_dict = base.pop("proxy", {})
|
|
60
|
+
if proxy_dict:
|
|
61
|
+
base.update(proxy_dict)
|
|
62
|
+
return base
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from typing import Any, Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload, ProxyPayload, UserAgentPayload
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class FunCaptchaTask(TaskPayload, UserAgentPayload):
|
|
9
|
+
"""
|
|
10
|
+
Represents a task for solving FunCaptcha (Arkose Labs) challenges.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
websiteURL: The URL of the page where the captcha is located.
|
|
14
|
+
websitePublicKey: FunCaptcha public key (pk).
|
|
15
|
+
funcaptchaApiJSSubdomain: Arkose Labs API subdomain, only if it differs
|
|
16
|
+
from the default client-api.arkoselabs.com.
|
|
17
|
+
data: Additional data parameter, required if the site uses data[blob].
|
|
18
|
+
cookies: Additional cookies in the format cookieName1=value1; cookieName2=value2.
|
|
19
|
+
proxy: Optional proxy settings.
|
|
20
|
+
"""
|
|
21
|
+
type: str = Field(default="FunCaptchaTask", frozen=True)
|
|
22
|
+
websiteURL: str = Field(..., description='The URL of the page where the captcha is located.')
|
|
23
|
+
websitePublicKey: str = Field(..., description='FunCaptcha public key (pk).')
|
|
24
|
+
funcaptchaApiJSSubdomain: Optional[str] = Field(
|
|
25
|
+
default=None,
|
|
26
|
+
description='Arkose Labs subdomain (surl). Specify only if it differs from client-api.arkoselabs.com.')
|
|
27
|
+
data: Optional[str] = Field(
|
|
28
|
+
default=None,
|
|
29
|
+
description='Additional data parameter, required if the site uses data[blob].')
|
|
30
|
+
cookies: Optional[str] = Field(
|
|
31
|
+
default=None,
|
|
32
|
+
description='Additional cookies in the format: cookieName1=value1; cookieName2=value2.')
|
|
33
|
+
proxy: Optional[ProxyPayload] = Field(default=None, description='Proxy settings.')
|
|
34
|
+
|
|
35
|
+
def to_request(self) -> dict[str, Any]:
|
|
36
|
+
base = self.model_dump(exclude_none=True)
|
|
37
|
+
proxy_dict = base.pop("proxy", {})
|
|
38
|
+
if proxy_dict:
|
|
39
|
+
base.update(proxy_dict)
|
|
40
|
+
return base
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
from typing import Optional, Any
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload, ProxyPayload, UserAgentPayload
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class GeeTestV3Task(TaskPayload, UserAgentPayload):
|
|
9
|
+
"""
|
|
10
|
+
Represents a payload for solving GeeTest V3 captcha.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
websiteURL:
|
|
14
|
+
Address of the page on which the captcha is being solved.
|
|
15
|
+
gt:
|
|
16
|
+
The GeeTest identifier key 'gt' corresponding to the domain.
|
|
17
|
+
challenge:
|
|
18
|
+
A dynamic key that must be fresh on each request. Reusing a non-fresh challenge
|
|
19
|
+
value will result in an ERROR_TOKEN_EXPIRED.
|
|
20
|
+
geetestApiServerSubdomain:
|
|
21
|
+
Optional API subdomain server for Geetest that must be different from
|
|
22
|
+
`api.geetest.com`.
|
|
23
|
+
geetestGetLib:
|
|
24
|
+
Optional path to the captcha script. This must be provided as a JSON string.
|
|
25
|
+
proxy:
|
|
26
|
+
Optional proxy settings to be used while solving the captcha.
|
|
27
|
+
"""
|
|
28
|
+
type: str = Field(default="GeeTestTask", frozen=True)
|
|
29
|
+
websiteURL: str = Field(..., description="Address of the page on which the captcha is solved.")
|
|
30
|
+
gt: str = Field(..., description="The GeeTest identifier key gt for the domain.")
|
|
31
|
+
challenge: str = Field(..., description=(
|
|
32
|
+
"A dynamic key. Must be fresh on each request. If the captcha is loaded on the page, "
|
|
33
|
+
"then the challenge value is no longer valid and you will get ERROR_TOKEN_EXPIRED."
|
|
34
|
+
))
|
|
35
|
+
geetestApiServerSubdomain: Optional[str] = Field(
|
|
36
|
+
default=None, description="Geetest API subdomain server (must differ from api.geetest.com)"
|
|
37
|
+
)
|
|
38
|
+
geetestGetLib: Optional[str] = Field(
|
|
39
|
+
default=None, description="Path to captcha script. Must be passed as JSON string."
|
|
40
|
+
)
|
|
41
|
+
proxy: Optional[ProxyPayload] = Field(default=None, description="Proxy settings.")
|
|
42
|
+
|
|
43
|
+
def to_request(self) -> dict[str, Any]:
|
|
44
|
+
base = self.model_dump(exclude_none=True)
|
|
45
|
+
proxy_dict = base.pop("proxy", {})
|
|
46
|
+
if proxy_dict:
|
|
47
|
+
base.update(proxy_dict)
|
|
48
|
+
return base
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class GeeTestV4Task(TaskPayload, UserAgentPayload):
|
|
52
|
+
"""
|
|
53
|
+
Represents a GeeTest V4 task payload.
|
|
54
|
+
|
|
55
|
+
Attributes:
|
|
56
|
+
type: Indicates the type of the task, defaulted and frozen as "GeeTestTask".
|
|
57
|
+
websiteURL: Address of the page on which the captcha is solved.
|
|
58
|
+
gt: The GeeTest identifier key gt for the domain.
|
|
59
|
+
version: Version of the GeeTest task, defaulted and frozen as 4.
|
|
60
|
+
initParameters: Extra parameters for v4, used with 'riskType' or challenge details.
|
|
61
|
+
geetestApiServerSubdomain: Geetest API subdomain server (must differ from api.geetest.com).
|
|
62
|
+
geetestGetLib: Path to a captcha script. Must be passed as a JSON string.
|
|
63
|
+
proxy: Proxy settings to be used for the task.
|
|
64
|
+
"""
|
|
65
|
+
type: str = Field(default="GeeTestTask", frozen=True)
|
|
66
|
+
websiteURL: str = Field(..., description="Address of the page on which the captcha is solved.")
|
|
67
|
+
gt: str = Field(..., description="The GeeTest identifier key gt for the domain.")
|
|
68
|
+
version: int = Field(default=4, frozen=True)
|
|
69
|
+
initParameters: Optional[object] = Field(
|
|
70
|
+
default=None,
|
|
71
|
+
description="Extra parameters for v4, used with 'riskType' or challenge details."
|
|
72
|
+
)
|
|
73
|
+
geetestApiServerSubdomain: Optional[str] = Field(
|
|
74
|
+
default=None, description="Geetest API subdomain server (must differ from api.geetest.com)"
|
|
75
|
+
)
|
|
76
|
+
geetestGetLib: Optional[str] = Field(
|
|
77
|
+
default=None, description="Path to captcha script. Must be passed as JSON string."
|
|
78
|
+
)
|
|
79
|
+
proxy: Optional[ProxyPayload] = Field(default=None, description="Proxy settings.")
|
|
80
|
+
|
|
81
|
+
def to_request(self) -> dict[str, Any]:
|
|
82
|
+
base = self.model_dump(exclude_none=True)
|
|
83
|
+
proxy_dict = base.pop("proxy", {})
|
|
84
|
+
if proxy_dict:
|
|
85
|
+
base.update(proxy_dict)
|
|
86
|
+
return base
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from typing import Optional, Any
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload, ProxyPayload, UserAgentPayload
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class HuntTask(TaskPayload, UserAgentPayload):
|
|
9
|
+
"""
|
|
10
|
+
Represents a task for solving Hunt captcha challenges.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
websiteURL: The URL of the webpage containing the captcha.
|
|
14
|
+
websiteKey: The Hunt captcha site key.
|
|
15
|
+
proxy: Optional proxy settings.
|
|
16
|
+
"""
|
|
17
|
+
type: str = Field(default="HuntTask", frozen=True)
|
|
18
|
+
websiteURL: str = Field(..., description='Address of a webpage with captcha.')
|
|
19
|
+
websiteKey: str = Field(..., description='Hunt captcha site key.')
|
|
20
|
+
proxy: Optional[ProxyPayload] = Field(default=None, description='Proxy settings.')
|
|
21
|
+
|
|
22
|
+
def to_request(self) -> dict[str, Any]:
|
|
23
|
+
base = self.model_dump(exclude_none=True)
|
|
24
|
+
proxy_dict = base.pop("proxy", {})
|
|
25
|
+
if proxy_dict:
|
|
26
|
+
base.update(proxy_dict)
|
|
27
|
+
return base
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from typing import Optional, Literal, Any
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ImageToTextTask(TaskPayload):
|
|
9
|
+
"""
|
|
10
|
+
Represents a task for solving image-based captcha using certain recognition parameters.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
body (str): File body encoded in base64. Ensure it is passed without any line breaks.
|
|
14
|
+
capMonsterModule (Optional[str]): The name of the recognition module (e.g., "yandex").
|
|
15
|
+
recognizingThreshold (Optional[int]): The threshold for captcha recognition confidence
|
|
16
|
+
with a range of 0 to 100. Ensures that you are charged only if recognition confidence
|
|
17
|
+
meets or exceeds this value.
|
|
18
|
+
case (Optional[bool]): Indicates whether the captcha is case-sensitive.
|
|
19
|
+
numeric (Optional[Literal[0, 1]]): Set to 1 if the captcha consists only of numbers.
|
|
20
|
+
math (Optional[bool]): Set to true if the captcha involves solving a mathematical operation.
|
|
21
|
+
"""
|
|
22
|
+
type: str = Field(default="ImageToTextTask", frozen=True)
|
|
23
|
+
body: str = Field(..., description="File body encoded in base64*. Make sure to pass it without line breaks.")
|
|
24
|
+
capMonsterModule: Optional[str] = Field(default=None,
|
|
25
|
+
description="The name of recognizing module, for example, “yandex“.")
|
|
26
|
+
recognizingThreshold: Optional[int] = Field(default=None,
|
|
27
|
+
description="Captcha recognition threshold with a possible value from "
|
|
28
|
+
"0 to 100. For example, if recognizingThreshold was set to "
|
|
29
|
+
"90 and the task was solved with a confidence of 80, "
|
|
30
|
+
"you won't be charged.",
|
|
31
|
+
ge=0, le=100)
|
|
32
|
+
case: Optional[bool] = Field(default=None, description="Set to true if captcha is case sensitive.")
|
|
33
|
+
numeric: Optional[Literal[0, 1]] = Field(default=None, description="Set to 1 if captcha contains numbers only.")
|
|
34
|
+
math: Optional[bool] = Field(default=None, description="Set to true if captcha requires a mathematical operation.")
|
|
35
|
+
|
|
36
|
+
def to_request(self) -> dict[str, Any]:
|
|
37
|
+
return self.model_dump(exclude_none=True)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from typing import Optional, Any
|
|
2
|
+
|
|
3
|
+
from pydantic import Field, BaseModel
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload, UserAgentPayload
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ImpervaTaskMetadata(BaseModel):
|
|
9
|
+
"""
|
|
10
|
+
Represents metadata related to an Imperva task.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
incapsulaScriptUrl: Name of the Incapsula JS file.
|
|
14
|
+
incapsulaCookie: Your cookies from Incapsula. They can be obtained on the
|
|
15
|
+
page using document.cookie.
|
|
16
|
+
reese84UrlEndpoint: Optional. The name of the endpoint where the reese84
|
|
17
|
+
fingerprint is sent, found among the network requests and typically
|
|
18
|
+
ending with "?d=site.com".
|
|
19
|
+
"""
|
|
20
|
+
incapsulaScriptUrl: str = Field(..., description="Name of the Incapsula JS file.")
|
|
21
|
+
incapsulaCookie: str = Field(...,
|
|
22
|
+
description="Your cookies from Incapsula. They can be obtained on the page using document.cookie")
|
|
23
|
+
reese84UrlEndpoint: Optional[str] = Field(default=None, description="The name of the endpoint where the reese84 "
|
|
24
|
+
"fingerprint is sent can be found among the "
|
|
25
|
+
"requests and ends with ?d=site.com")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ImpervaTask(TaskPayload, UserAgentPayload):
|
|
29
|
+
"""
|
|
30
|
+
Represents a task for handling and solving an Imperva-based challenge.
|
|
31
|
+
|
|
32
|
+
Attributes:
|
|
33
|
+
type (str): The identifier for the type of task. This attribute is
|
|
34
|
+
frozen and defaults to "CustomTask".
|
|
35
|
+
|
|
36
|
+
class_ (str): The identifier for the class of the task. This attribute is
|
|
37
|
+
frozen, defaults to "Imperva", and is aliased to "class" for external usage.
|
|
38
|
+
|
|
39
|
+
websiteURL (str): The URL of the website targeted for solving the challenge.
|
|
40
|
+
|
|
41
|
+
metadata (ImpervaTaskMetadata): Encapsulated metadata specific to the
|
|
42
|
+
Imperva challenge, such as the website key.
|
|
43
|
+
"""
|
|
44
|
+
type: str = Field(default="CustomTask", frozen=True)
|
|
45
|
+
class_: str = Field(default="Imperva", alias="class", frozen=True)
|
|
46
|
+
websiteURL: str = Field(..., description="URL of the website to be solved.")
|
|
47
|
+
metadata: ImpervaTaskMetadata = Field(..., description="Website key.")
|
|
48
|
+
|
|
49
|
+
def to_request(self) -> dict[str, Any]:
|
|
50
|
+
return self.model_dump(exclude_none=True, by_alias=True)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from typing import Any, Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload, ProxyPayload, UserAgentPayload
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class MTCaptchaTask(TaskPayload, UserAgentPayload):
|
|
9
|
+
"""
|
|
10
|
+
Represents a task for solving MTCaptcha challenges.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
websiteURL: URL of the page where the captcha is solved.
|
|
14
|
+
websiteKey: The MTCaptcha site key (passed as sk in network requests).
|
|
15
|
+
pageAction: The action parameter (passed as act in requests).
|
|
16
|
+
Only needed if it differs from the default "$".
|
|
17
|
+
isInvisible: Set to true if the captcha is invisible.
|
|
18
|
+
proxy: Optional proxy settings.
|
|
19
|
+
"""
|
|
20
|
+
type: str = Field(default="MTCaptchaTask", frozen=True)
|
|
21
|
+
websiteURL: str = Field(..., description='URL of the page where the captcha is solved.')
|
|
22
|
+
websiteKey: str = Field(..., description='The MTCaptcha site key (passed as sk in network requests).')
|
|
23
|
+
pageAction: Optional[str] = Field(
|
|
24
|
+
default=None,
|
|
25
|
+
description='The action parameter (passed as act in requests). Only needed if different from default.')
|
|
26
|
+
isInvisible: Optional[bool] = Field(
|
|
27
|
+
default=None,
|
|
28
|
+
description='Set to true if the captcha is invisible.')
|
|
29
|
+
proxy: Optional[ProxyPayload] = Field(default=None, description='Proxy settings.')
|
|
30
|
+
|
|
31
|
+
def to_request(self) -> dict[str, Any]:
|
|
32
|
+
base = self.model_dump(exclude_none=True)
|
|
33
|
+
proxy_dict = base.pop("proxy", {})
|
|
34
|
+
if proxy_dict:
|
|
35
|
+
base.update(proxy_dict)
|
|
36
|
+
return base
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from typing import Optional, Any
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from .task import TaskPayload, ProxyPayload
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ProsopoTask(TaskPayload):
|
|
9
|
+
"""
|
|
10
|
+
Represents a Prosopo CAPTCHA solving task.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
websiteURL: The full URL of the CAPTCHA page that needs to be solved.
|
|
14
|
+
websiteKey: The site key parameter value obtained from the CAPTCHA page.
|
|
15
|
+
proxy: Optional proxy settings to be used in sending the task request.
|
|
16
|
+
"""
|
|
17
|
+
type: str = Field(default="ProsopoTask", frozen=True)
|
|
18
|
+
websiteURL: str = Field(..., description="The full URL of the CAPTCHA page.")
|
|
19
|
+
websiteKey: str = Field(..., description="The value of the siteKey parameter found on the page.")
|
|
20
|
+
proxy: Optional[ProxyPayload] = Field(default=None, description="Proxy settings.")
|
|
21
|
+
|
|
22
|
+
def to_request(self) -> dict[str, Any]:
|
|
23
|
+
base = self.model_dump(exclude_none=True)
|
|
24
|
+
proxy_dict = base.pop("proxy", {})
|
|
25
|
+
if proxy_dict:
|
|
26
|
+
base.update(proxy_dict)
|
|
27
|
+
return base
|