python3-capsolver 0.5.7__py3-none-any.whl → 0.6.1__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.
- python3_capsolver/__version__.py +1 -1
- python3_capsolver/cloudflare.py +120 -0
- python3_capsolver/control.py +15 -26
- python3_capsolver/core/base.py +0 -3
- python3_capsolver/core/enum.py +13 -17
- python3_capsolver/core/serializer.py +12 -8
- python3_capsolver/datadome_slider.py +35 -91
- python3_capsolver/gee_test.py +0 -1
- python3_capsolver/hcaptcha.py +0 -1
- python3_capsolver/image_to_text.py +0 -1
- python3_capsolver/mt_captcha.py +35 -81
- python3_capsolver/recaptcha.py +30 -0
- {python3_capsolver-0.5.7.dist-info → python3_capsolver-0.6.1.dist-info}/METADATA +27 -17
- python3_capsolver-0.6.1.dist-info/RECORD +20 -0
- python3_capsolver/kasada.py +0 -176
- python3_capsolver-0.5.7.dist-info/RECORD +0 -20
- {python3_capsolver-0.5.7.dist-info → python3_capsolver-0.6.1.dist-info}/WHEEL +0 -0
- {python3_capsolver-0.5.7.dist-info → python3_capsolver-0.6.1.dist-info}/top_level.txt +0 -0
python3_capsolver/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.6.1"
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
from typing import Dict, Union, Optional
|
|
2
|
+
|
|
3
|
+
from python3_capsolver.core.base import BaseCaptcha
|
|
4
|
+
from python3_capsolver.core.enum import CloudflareTypeEnm
|
|
5
|
+
from python3_capsolver.core.serializer import CaptchaResponseSer, CloudflareTurnstileSer
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Cloudflare(BaseCaptcha):
|
|
9
|
+
"""
|
|
10
|
+
The class is used to work with Capsolver Cloudflare methods.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
api_key: Capsolver API key
|
|
14
|
+
captcha_type: Captcha type name, like ``ReCaptchaV2Task`` and etc.
|
|
15
|
+
websiteURL: Address of a webpage with Google ReCaptcha
|
|
16
|
+
websiteKey: Recaptcha website key. <div class="g-recaptcha" data-sitekey="THAT_ONE"></div>
|
|
17
|
+
metadata: Extra data
|
|
18
|
+
html: You can pass in the entire html source code for the challenge directly.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Examples:
|
|
22
|
+
>>> Cloudflare(api_key="CAI-1324...",
|
|
23
|
+
... captcha_type=CloudflareTypeEnm.AntiCloudflareTask,
|
|
24
|
+
... websiteURL="https://bck.websiteurl.com/registry",
|
|
25
|
+
... websiteKey='4ac25d',
|
|
26
|
+
... proxy="socks5:158.120.100.23:334:user:pass",
|
|
27
|
+
... metadata={'type': 'turnstile', 'acton':'login', 'cdata': '0000-1111-2222-3333-example-cdata'}
|
|
28
|
+
... ).captcha_handler()
|
|
29
|
+
CaptchaResponseSer(errorId=False,
|
|
30
|
+
errorCode=None,
|
|
31
|
+
errorDescription=None,
|
|
32
|
+
taskId='73bdcd28-6c77-4414-8....',
|
|
33
|
+
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
34
|
+
solution={'gRecaptchaResponse': '44795sds...'}
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
>>> Cloudflare(api_key="CAI-1324...",
|
|
38
|
+
... captcha_type=CloudflareTypeEnm.AntiCloudflareTask,
|
|
39
|
+
... websiteURL="https://bck.websiteurl.com/registry",
|
|
40
|
+
... proxy="socks5:158.120.100.23:334:user:pass",
|
|
41
|
+
... metadata={'type': 'challenge'}
|
|
42
|
+
... html="<your challenge html source code>",
|
|
43
|
+
... ).captcha_handler()
|
|
44
|
+
CaptchaResponseSer(errorId=False,
|
|
45
|
+
errorCode=None,
|
|
46
|
+
errorDescription=None,
|
|
47
|
+
taskId='73bdcd28-6c77-4414-8....',
|
|
48
|
+
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
49
|
+
solution={'gRecaptchaResponse': '44795sds...'}
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
>>> await Cloudflare(api_key="CAI-1324...",
|
|
53
|
+
... captcha_type=CloudflareTypeEnm.AntiCloudflareTask,
|
|
54
|
+
... websiteURL="https://bck.websiteurl.com/registry",
|
|
55
|
+
... websiteKey='4ac25d',
|
|
56
|
+
... proxy="socks5:158.120.100.23:334:user:pass",
|
|
57
|
+
... metadata={'type': 'challenge', 'acton':'login', 'cdata': '0000-1111-2222-3333-example-cdata'}
|
|
58
|
+
... ).aio_captcha_handler()
|
|
59
|
+
CaptchaResponseSer(errorId=False,
|
|
60
|
+
errorCode=None,
|
|
61
|
+
errorDescription=None,
|
|
62
|
+
taskId='73bdcd28-6c77-4414-8....',
|
|
63
|
+
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
64
|
+
solution={'gRecaptchaResponse': '44795sds...'}
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
CaptchaResponseSer model with full server response
|
|
69
|
+
|
|
70
|
+
Notes:
|
|
71
|
+
https://docs.capsolver.com/guide/antibots/cloudflare_turnstile.html
|
|
72
|
+
https://docs.capsolver.com/guide/antibots/cloudflare_challenge.html
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
def __init__(
|
|
76
|
+
self,
|
|
77
|
+
captcha_type: Union[CloudflareTypeEnm, str],
|
|
78
|
+
websiteURL: str,
|
|
79
|
+
metadata: Dict[str, str],
|
|
80
|
+
websiteKey: Optional[str] = None,
|
|
81
|
+
html: Optional[str] = None,
|
|
82
|
+
*args,
|
|
83
|
+
**kwargs,
|
|
84
|
+
):
|
|
85
|
+
super().__init__(*args, **kwargs)
|
|
86
|
+
|
|
87
|
+
if captcha_type in CloudflareTypeEnm.list():
|
|
88
|
+
self.task_params = CloudflareTurnstileSer(**locals()).dict(exclude_none=True)
|
|
89
|
+
else:
|
|
90
|
+
raise ValueError(
|
|
91
|
+
f"""Invalid `captcha_type` parameter set for `{self.__class__.__name__}`,
|
|
92
|
+
available - {CloudflareTypeEnm.list()}"""
|
|
93
|
+
)
|
|
94
|
+
for key in kwargs:
|
|
95
|
+
self.task_params.update({key: kwargs[key]})
|
|
96
|
+
|
|
97
|
+
def captcha_handler(self) -> CaptchaResponseSer:
|
|
98
|
+
"""
|
|
99
|
+
Sync method for captcha solving
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
CaptchaResponseSer model with full service response
|
|
103
|
+
|
|
104
|
+
Notes:
|
|
105
|
+
Check class docstring for more info
|
|
106
|
+
"""
|
|
107
|
+
return self._processing_captcha(create_params=self.task_params)
|
|
108
|
+
|
|
109
|
+
async def aio_captcha_handler(self) -> CaptchaResponseSer:
|
|
110
|
+
"""
|
|
111
|
+
Async method for captcha solving
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
Returns:
|
|
115
|
+
CaptchaResponseSer model with full service response
|
|
116
|
+
|
|
117
|
+
Notes:
|
|
118
|
+
Check class docstring for more info
|
|
119
|
+
"""
|
|
120
|
+
return await self._aio_processing_captcha(create_params=self.task_params)
|
python3_capsolver/control.py
CHANGED
|
@@ -1,52 +1,41 @@
|
|
|
1
1
|
from python3_capsolver.core.base import BaseCaptcha
|
|
2
2
|
from python3_capsolver.core.enum import EndpointPostfixEnm
|
|
3
|
-
from python3_capsolver.core.config import REQUEST_URL
|
|
4
3
|
from python3_capsolver.core.serializer import PostRequestSer, ControlResponseSer
|
|
5
4
|
|
|
6
5
|
|
|
7
|
-
class
|
|
6
|
+
class Control(BaseCaptcha):
|
|
8
7
|
"""
|
|
8
|
+
The class is used to work with Capsolver control methods.
|
|
9
|
+
|
|
9
10
|
Args:
|
|
10
11
|
api_key: Capsolver API key
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
Notes:
|
|
14
|
+
https://docs.capsolver.com/guide/api-getbalance.html
|
|
13
15
|
"""
|
|
14
16
|
|
|
15
17
|
serializer = PostRequestSer
|
|
16
18
|
|
|
17
19
|
def __init__(
|
|
18
20
|
self,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
request_url: str = REQUEST_URL,
|
|
21
|
+
*args,
|
|
22
|
+
**kwargs,
|
|
22
23
|
):
|
|
23
|
-
|
|
24
|
-
super().__init__(
|
|
25
|
-
api_key=api_key, sleep_time=sleep_time, request_url=request_url, captcha_type="CaptchaTypeEnm.Control"
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class Control(BaseControl):
|
|
30
|
-
"""
|
|
31
|
-
The class is used to work with Capsolver control methods.
|
|
32
|
-
|
|
33
|
-
Notes:
|
|
34
|
-
https://captchaai.atlassian.net/wiki/spaces/CAPTCHAAI/pages/426042/API+Methods
|
|
35
|
-
"""
|
|
24
|
+
super().__init__(*args, **kwargs)
|
|
36
25
|
|
|
37
26
|
def get_balance(self) -> ControlResponseSer:
|
|
38
27
|
"""
|
|
39
28
|
Synchronous method to view the balance
|
|
40
29
|
|
|
41
30
|
Examples:
|
|
42
|
-
>>> Control(api_key="CAI-
|
|
43
|
-
|
|
31
|
+
>>> Control(api_key="CAI-1324...").get_balance()
|
|
32
|
+
ControlResponseSer(errorId=0 errorCode=None errorDescription=None balance=150.9085)
|
|
44
33
|
|
|
45
34
|
Returns:
|
|
46
35
|
ResponseSer model with full server response
|
|
47
36
|
|
|
48
37
|
Notes:
|
|
49
|
-
https://
|
|
38
|
+
https://docs.capsolver.com/guide/api-getbalance.html
|
|
50
39
|
"""
|
|
51
40
|
self._prepare_create_task_payload(serializer=self.serializer)
|
|
52
41
|
return ControlResponseSer(
|
|
@@ -60,14 +49,14 @@ class Control(BaseControl):
|
|
|
60
49
|
Asynchronous method to view the balance
|
|
61
50
|
|
|
62
51
|
Examples:
|
|
63
|
-
>>> await Control(api_key="CAI-
|
|
64
|
-
|
|
52
|
+
>>> await Control(api_key="CAI-1324...").aio_get_balance()
|
|
53
|
+
ControlResponseSer(errorId=0 errorCode=None errorDescription=None balance=150.9085)
|
|
65
54
|
|
|
66
55
|
Returns:
|
|
67
56
|
ResponseSer model with full server response
|
|
68
57
|
|
|
69
58
|
Notes:
|
|
70
|
-
https://
|
|
59
|
+
https://docs.capsolver.com/guide/api-getbalance.html
|
|
71
60
|
"""
|
|
72
61
|
self._prepare_create_task_payload(serializer=self.serializer)
|
|
73
62
|
return ControlResponseSer(
|
python3_capsolver/core/base.py
CHANGED
|
@@ -102,12 +102,9 @@ class BaseCaptcha:
|
|
|
102
102
|
Function send SYNC request to service and wait for result
|
|
103
103
|
"""
|
|
104
104
|
try:
|
|
105
|
-
print(self.task_payload.dict(exclude_none=True))
|
|
106
105
|
resp = self.__session.post(
|
|
107
106
|
parse.urljoin(self.__request_url, url_postfix), json=self.task_payload.dict(exclude_none=True)
|
|
108
107
|
)
|
|
109
|
-
print(resp.status_code)
|
|
110
|
-
print(resp.json())
|
|
111
108
|
if resp.status_code in VALID_STATUS_CODES:
|
|
112
109
|
return resp.json()
|
|
113
110
|
else:
|
python3_capsolver/core/enum.py
CHANGED
|
@@ -52,15 +52,12 @@ class CaptchaTypeEnmXXX(str, MyEnum):
|
|
|
52
52
|
https://captchaai.atlassian.net/wiki/spaces/CAPTCHAAI/pages/393295
|
|
53
53
|
"""
|
|
54
54
|
|
|
55
|
-
Control = "Control" # custom captcha type
|
|
56
55
|
ImageToTextTask = "ImageToTextTask"
|
|
57
56
|
# HCaptcha
|
|
58
57
|
HCaptchaClassification = "HCaptchaClassification"
|
|
59
58
|
# FunCaptcha
|
|
60
59
|
FunCaptchaClassification = "FunCaptchaClassification"
|
|
61
60
|
# Other types
|
|
62
|
-
MtCaptchaTask = "MtCaptchaTask"
|
|
63
|
-
DatadomeSliderTask = "DatadomeSliderTask"
|
|
64
61
|
AntiKasadaTask = "AntiKasadaTask"
|
|
65
62
|
AntiAkamaiBMPTask = "AntiAkamaiBMPTask"
|
|
66
63
|
|
|
@@ -99,6 +96,19 @@ class ReCaptchaV3TypeEnm(str, MyEnum):
|
|
|
99
96
|
ReCaptchaV3EnterpriseTaskProxyLess = "ReCaptchaV3EnterpriseTaskProxyLess"
|
|
100
97
|
|
|
101
98
|
|
|
99
|
+
class MtCaptchaTypeEnm(str, MyEnum):
|
|
100
|
+
MtCaptchaTask = "MtCaptchaTask"
|
|
101
|
+
MtCaptchaTaskProxyLess = "MtCaptchaTaskProxyLess"
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class DatadomeSliderTypeEnm(str, MyEnum):
|
|
105
|
+
DatadomeSliderTask = "DatadomeSliderTask"
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class CloudflareTypeEnm(str, MyEnum):
|
|
109
|
+
AntiCloudflareTask = "AntiCloudflareTask"
|
|
110
|
+
|
|
111
|
+
|
|
102
112
|
class ResponseStatusEnm(str, MyEnum):
|
|
103
113
|
"""
|
|
104
114
|
Enum store results `status` field variants
|
|
@@ -111,17 +121,3 @@ class ResponseStatusEnm(str, MyEnum):
|
|
|
111
121
|
Processing = "processing" # Task is not ready yet
|
|
112
122
|
Ready = "ready" # Task completed, solution object can be found in solution property
|
|
113
123
|
Failed = "failed" # Task failed, check the errorDescription to know why failed.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
class ProxyType(str, MyEnum):
|
|
117
|
-
"""
|
|
118
|
-
Enum store proxy types
|
|
119
|
-
|
|
120
|
-
Notes:
|
|
121
|
-
https://captchaai.atlassian.net/wiki/spaces/CAPTCHAAI/pages/426124
|
|
122
|
-
"""
|
|
123
|
-
|
|
124
|
-
http = "http" # usual http / https
|
|
125
|
-
https = "https"
|
|
126
|
-
socks4 = "socks4"
|
|
127
|
-
socks5 = "socks5"
|
|
@@ -12,6 +12,7 @@ HTTP API Request ser
|
|
|
12
12
|
|
|
13
13
|
class PostRequestSer(BaseModel):
|
|
14
14
|
clientKey: str = Field(..., description="Client account key, can be found in user account")
|
|
15
|
+
task: dict = Field(None, description="Task object")
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
class TaskSer(BaseModel):
|
|
@@ -19,7 +20,6 @@ class TaskSer(BaseModel):
|
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
class RequestCreateTaskSer(PostRequestSer):
|
|
22
|
-
task: dict = Field(None, description="Task object")
|
|
23
23
|
appId: str = Field(APP_ID, description="AppID", const=True)
|
|
24
24
|
|
|
25
25
|
|
|
@@ -50,7 +50,6 @@ class CaptchaResponseSer(ResponseSer):
|
|
|
50
50
|
|
|
51
51
|
class ControlResponseSer(ResponseSer):
|
|
52
52
|
balance: Optional[float] = Field(0, description="Account balance value in USD")
|
|
53
|
-
packages: List = Field(None, description="Monthly Packages")
|
|
54
53
|
|
|
55
54
|
|
|
56
55
|
"""
|
|
@@ -70,7 +69,7 @@ Captcha tasks ser
|
|
|
70
69
|
|
|
71
70
|
class WebsiteDataOptionsSer(TaskSer):
|
|
72
71
|
websiteURL: str = Field(..., description="Address of a webpage with Captcha")
|
|
73
|
-
websiteKey: str = Field(
|
|
72
|
+
websiteKey: Optional[str] = Field(None, description="Website key")
|
|
74
73
|
|
|
75
74
|
|
|
76
75
|
class ReCaptchaV3Ser(WebsiteDataOptionsSer):
|
|
@@ -107,13 +106,11 @@ class FunCaptchaSer(TaskSer):
|
|
|
107
106
|
)
|
|
108
107
|
|
|
109
108
|
|
|
110
|
-
class
|
|
109
|
+
class DatadomeSliderSer(TaskSer):
|
|
111
110
|
websiteURL: str = Field(..., description="Address of a webpage with DatadomeSlider")
|
|
112
111
|
captchaUrl: str = Field(..., description="Captcha Url where is the captcha")
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
class MtCaptchaOptionsSer(WebsiteDataOptionsSer):
|
|
116
|
-
proxy: str = Field(..., description="String with proxy connection params, example: `198.22.3.1:10001:user:pwd`")
|
|
112
|
+
proxy: str = Field(..., description="Proxy data")
|
|
113
|
+
userAgent: str = Field(..., description="Browser's User-Agent which is used in emulation")
|
|
117
114
|
|
|
118
115
|
|
|
119
116
|
class KasadaOptionsSer(BaseModel):
|
|
@@ -124,3 +121,10 @@ class KasadaOptionsSer(BaseModel):
|
|
|
124
121
|
"This isn’t required if you are using proxies authenticated by IP",
|
|
125
122
|
)
|
|
126
123
|
proxyPassword: str = Field(..., description="This isn’t required if you are using proxies authenticated by IP")
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class CloudflareTurnstileSer(WebsiteDataOptionsSer):
|
|
127
|
+
metadata: dict = Field(..., description="Extra data")
|
|
128
|
+
html: Optional[str] = Field(
|
|
129
|
+
None, description="You can pass in the entire html source code for the challenge directly."
|
|
130
|
+
)
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
from typing import Union
|
|
1
|
+
from typing import Union
|
|
2
2
|
|
|
3
3
|
from python3_capsolver.core.base import BaseCaptcha
|
|
4
|
-
from python3_capsolver.core.enum import
|
|
5
|
-
from python3_capsolver.core.
|
|
6
|
-
from python3_capsolver.core.serializer import CaptchaResponseSer, RequestCreateTaskSer, DatadomeSliderOptionsSer
|
|
4
|
+
from python3_capsolver.core.enum import DatadomeSliderTypeEnm
|
|
5
|
+
from python3_capsolver.core.serializer import DatadomeSliderSer, CaptchaResponseSer
|
|
7
6
|
|
|
8
7
|
|
|
9
|
-
class
|
|
8
|
+
class DatadomeSlider(BaseCaptcha):
|
|
10
9
|
"""
|
|
11
10
|
The class is used to work with Capsolver DatadomeSlider method.
|
|
12
11
|
|
|
@@ -14,22 +13,16 @@ class BaseDatadomeSlider(BaseCaptcha):
|
|
|
14
13
|
api_key: Capsolver API key
|
|
15
14
|
websiteURL: Address of the webpage
|
|
16
15
|
captchaUrl: Captcha Url where is the captcha
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
host names instead of IPs,
|
|
20
|
-
transparent proxies (where client IP is visible),
|
|
21
|
-
proxies from local networks (192.., 10.., 127...)
|
|
22
|
-
proxyPort: Proxy port.
|
|
23
|
-
sleep_time: The waiting time between requests to get the result of the Captcha
|
|
24
|
-
request_url: API address for sending requests
|
|
16
|
+
proxy: Proxy data
|
|
17
|
+
userAgent: Browser's User-Agent which is used in emulation
|
|
25
18
|
|
|
26
19
|
Examples:
|
|
27
20
|
>>> DatadomeSlider(api_key="CAI-1324...",
|
|
21
|
+
... captcha_type=DatadomeSliderTypeEnm.DatadomeSliderTask,
|
|
28
22
|
... websiteURL="https://www.some-url.com/",
|
|
29
23
|
... captchaUrl="https://www.some-url.com/to-page-with-captcha",
|
|
30
|
-
...
|
|
31
|
-
...
|
|
32
|
-
... proxyPort=9090,
|
|
24
|
+
... proxy="socks5:158.120.100.23:334:user:pass",
|
|
25
|
+
... userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
|
|
33
26
|
... ).captcha_handler()
|
|
34
27
|
CaptchaResponseSer(errorId=False,
|
|
35
28
|
errorCode=None,
|
|
@@ -40,11 +33,11 @@ class BaseDatadomeSlider(BaseCaptcha):
|
|
|
40
33
|
)
|
|
41
34
|
|
|
42
35
|
>>> await DatadomeSlider(api_key="CAI-1324...",
|
|
36
|
+
... captcha_type="DatadomeSliderTask",
|
|
43
37
|
... websiteURL="https://www.some-url.com/",
|
|
44
38
|
... captchaUrl="https://www.some-url.com/to-page-with-captcha",
|
|
45
|
-
...
|
|
46
|
-
...
|
|
47
|
-
... proxyPort=9090,
|
|
39
|
+
... proxy="socks5:158.120.100.23:334:user:pass",
|
|
40
|
+
... userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
|
|
48
41
|
... ).aio_captcha_handler()
|
|
49
42
|
CaptchaResponseSer(errorId=False,
|
|
50
43
|
errorCode=None,
|
|
@@ -58,60 +51,34 @@ class BaseDatadomeSlider(BaseCaptcha):
|
|
|
58
51
|
CaptchaResponseSer model with full server response
|
|
59
52
|
|
|
60
53
|
Notes:
|
|
61
|
-
https://
|
|
54
|
+
https://docs.capsolver.com/guide/antibots/datadome.html
|
|
62
55
|
"""
|
|
63
56
|
|
|
64
57
|
def __init__(
|
|
65
58
|
self,
|
|
66
|
-
|
|
59
|
+
captcha_type: Union[DatadomeSliderTypeEnm, str],
|
|
67
60
|
websiteURL: str,
|
|
68
61
|
captchaUrl: str,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
request_url: Optional[str] = REQUEST_URL,
|
|
62
|
+
proxy: str,
|
|
63
|
+
userAgent: str,
|
|
64
|
+
*args,
|
|
65
|
+
**kwargs,
|
|
74
66
|
):
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
def captcha_handler(
|
|
89
|
-
self,
|
|
90
|
-
**additional_params,
|
|
91
|
-
) -> CaptchaResponseSer:
|
|
67
|
+
super().__init__(*args, **kwargs)
|
|
68
|
+
|
|
69
|
+
if captcha_type in DatadomeSliderTypeEnm.list():
|
|
70
|
+
self.task_params = DatadomeSliderSer(**locals()).dict()
|
|
71
|
+
else:
|
|
72
|
+
raise ValueError(
|
|
73
|
+
f"""Invalid `captcha_type` parameter set for `{self.__class__.__name__}`,
|
|
74
|
+
available - {DatadomeSliderTypeEnm.list()}"""
|
|
75
|
+
)
|
|
76
|
+
for key in kwargs:
|
|
77
|
+
self.task_params.update({key: kwargs[key]})
|
|
78
|
+
|
|
79
|
+
def captcha_handler(self) -> CaptchaResponseSer:
|
|
92
80
|
"""
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
Args:
|
|
96
|
-
additional_params: Some additional parameters that will be used in creating the task
|
|
97
|
-
and will be passed to the payload under ``task`` key.
|
|
98
|
-
Like ``proxyPassword``, ``userAgent`` and etc. - more info in service docs
|
|
99
|
-
|
|
100
|
-
Examples:
|
|
101
|
-
>>> DatadomeSlider(api_key="CAI-1324...",
|
|
102
|
-
... websiteURL="https://www.some-url.com/",
|
|
103
|
-
... captchaUrl="https://www.some-url.com/to-page-with-captcha",
|
|
104
|
-
... proxyType="http",
|
|
105
|
-
... proxyAddress="0.0.0.0",
|
|
106
|
-
... proxyPort=9090,
|
|
107
|
-
... ).captcha_handler()
|
|
108
|
-
CaptchaResponseSer(errorId=False,
|
|
109
|
-
errorCode=None,
|
|
110
|
-
errorDescription=None,
|
|
111
|
-
taskId='73bdcd28-6c77-4414-8....',
|
|
112
|
-
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
113
|
-
solution={'gRecaptchaResponse': '44795sds...'}
|
|
114
|
-
)
|
|
81
|
+
Sync method for captcha solving
|
|
115
82
|
|
|
116
83
|
Returns:
|
|
117
84
|
CaptchaResponseSer model with full service response
|
|
@@ -119,35 +86,14 @@ class DatadomeSlider(BaseDatadomeSlider):
|
|
|
119
86
|
Notes:
|
|
120
87
|
Check class docstring for more info
|
|
121
88
|
"""
|
|
122
|
-
return self._processing_captcha(
|
|
89
|
+
return self._processing_captcha(create_params=self.task_params)
|
|
123
90
|
|
|
124
91
|
async def aio_captcha_handler(
|
|
125
92
|
self,
|
|
126
93
|
**additional_params,
|
|
127
94
|
) -> CaptchaResponseSer:
|
|
128
95
|
"""
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
Args:
|
|
132
|
-
additional_params: Some additional parameters that will be used in creating the task
|
|
133
|
-
and will be passed to the payload under ``task`` key.
|
|
134
|
-
Like ``coordinate``, ``enterprisePayload`` and etc. - more info in service docs
|
|
135
|
-
|
|
136
|
-
Examples:
|
|
137
|
-
>>> await DatadomeSlider(api_key="CAI-1324...",
|
|
138
|
-
... websiteURL="https://www.some-url.com/",
|
|
139
|
-
... captchaUrl="https://www.some-url.com/to-page-with-captcha",
|
|
140
|
-
... proxyType="http",
|
|
141
|
-
... proxyAddress="0.0.0.0",
|
|
142
|
-
... proxyPort=9090,
|
|
143
|
-
... ).aio_captcha_handler()
|
|
144
|
-
CaptchaResponseSer(errorId=False,
|
|
145
|
-
errorCode=None,
|
|
146
|
-
errorDescription=None,
|
|
147
|
-
taskId='73bdcd28-6c77-4414-8....',
|
|
148
|
-
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
149
|
-
solution={'gRecaptchaResponse': '44795sds...'}
|
|
150
|
-
)
|
|
96
|
+
Async method for captcha solving
|
|
151
97
|
|
|
152
98
|
Returns:
|
|
153
99
|
CaptchaResponseSer model with full service response
|
|
@@ -155,6 +101,4 @@ class DatadomeSlider(BaseDatadomeSlider):
|
|
|
155
101
|
Notes:
|
|
156
102
|
Check class docstring for more info
|
|
157
103
|
"""
|
|
158
|
-
return await self._aio_processing_captcha(
|
|
159
|
-
serializer=RequestCreateTaskSer, type=self.captcha_type, **additional_params
|
|
160
|
-
)
|
|
104
|
+
return await self._aio_processing_captcha(create_params=self.task_params)
|
python3_capsolver/gee_test.py
CHANGED
python3_capsolver/hcaptcha.py
CHANGED
python3_capsolver/mt_captcha.py
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Union
|
|
2
2
|
|
|
3
3
|
from python3_capsolver.core.base import BaseCaptcha
|
|
4
|
-
from python3_capsolver.core.
|
|
5
|
-
from python3_capsolver.core.serializer import CaptchaResponseSer,
|
|
4
|
+
from python3_capsolver.core.enum import MtCaptchaTypeEnm
|
|
5
|
+
from python3_capsolver.core.serializer import CaptchaResponseSer, WebsiteDataOptionsSer
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class
|
|
8
|
+
class MtCaptcha(BaseCaptcha):
|
|
9
9
|
"""
|
|
10
10
|
The class is used to work with Capsolver MtCaptcha method.
|
|
11
11
|
|
|
12
12
|
Args:
|
|
13
13
|
api_key: Capsolver API key
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
sleep_time: The waiting time between requests to get the result of the Captcha
|
|
18
|
-
request_url: API address for sending requests
|
|
14
|
+
captcha_type: Captcha type name, like ``MtCaptchaTask`` and etc.
|
|
15
|
+
websiteURL: Address of a webpage with Google ReCaptcha
|
|
16
|
+
websiteKey: Recaptcha website key. <div class="g-recaptcha" data-sitekey="THAT_ONE"></div>
|
|
19
17
|
|
|
20
18
|
Examples:
|
|
21
19
|
>>> MtCaptcha(api_key="CAI-1324...",
|
|
20
|
+
... captcha_type=MtCaptchaTypeEnm.MtCaptchaTaskProxyLess,
|
|
22
21
|
... websiteURL="https://www.mtcaptcha.com/#mtcaptcha-demo",
|
|
23
22
|
... websiteKey="MTPublic-tqNCRE0GS",
|
|
24
23
|
... proxy="198.22.3.1:10001:user:pwd"
|
|
@@ -32,10 +31,11 @@ class BaseMtCaptcha(BaseCaptcha):
|
|
|
32
31
|
)
|
|
33
32
|
|
|
34
33
|
>>> MtCaptcha(api_key="CAI-1324...",
|
|
34
|
+
... captcha_type=MtCaptchaTypeEnm.MtCaptchaTask,
|
|
35
35
|
... websiteURL="https://www.mtcaptcha.com/#mtcaptcha-demo",
|
|
36
36
|
... websiteKey="MTPublic-tqNCRE0GS",
|
|
37
37
|
... proxy="198.22.3.1:10001:user:pwd"
|
|
38
|
-
... ).captcha_handler(
|
|
38
|
+
... ).captcha_handler()
|
|
39
39
|
CaptchaResponseSer(errorId=False,
|
|
40
40
|
errorCode=None,
|
|
41
41
|
errorDescription=None,
|
|
@@ -45,6 +45,7 @@ class BaseMtCaptcha(BaseCaptcha):
|
|
|
45
45
|
)
|
|
46
46
|
|
|
47
47
|
>>> await MtCaptcha(api_key="CAI-1324...",
|
|
48
|
+
... captcha_type=MtCaptchaTypeEnm.MtCaptchaTask,
|
|
48
49
|
... websiteURL="https://www.mtcaptcha.com/#mtcaptcha-demo",
|
|
49
50
|
... websiteKey="MTPublic-tqNCRE0GS",
|
|
50
51
|
... proxy="198.22.3.1:10001:user:pwd"
|
|
@@ -58,10 +59,11 @@ class BaseMtCaptcha(BaseCaptcha):
|
|
|
58
59
|
)
|
|
59
60
|
|
|
60
61
|
>>> await MtCaptcha(api_key="CAI-1324...",
|
|
62
|
+
... captcha_type=MtCaptchaTypeEnm.MtCaptchaTask,
|
|
61
63
|
... websiteURL="https://www.mtcaptcha.com/#mtcaptcha-demo",
|
|
62
64
|
... websiteKey="MTPublic-tqNCRE0GS",
|
|
63
65
|
... proxy="198.22.3.1:10001:user:pwd"
|
|
64
|
-
... ).aio_captcha_handler(
|
|
66
|
+
... ).aio_captcha_handler()
|
|
65
67
|
CaptchaResponseSer(errorId=False,
|
|
66
68
|
errorCode=None,
|
|
67
69
|
errorDescription=None,
|
|
@@ -74,56 +76,32 @@ class BaseMtCaptcha(BaseCaptcha):
|
|
|
74
76
|
CaptchaResponseSer model with full server response
|
|
75
77
|
|
|
76
78
|
Notes:
|
|
77
|
-
https://
|
|
79
|
+
https://docs.capsolver.com/guide/captcha/MtCaptcha.html
|
|
78
80
|
"""
|
|
79
81
|
|
|
80
82
|
def __init__(
|
|
81
83
|
self,
|
|
82
|
-
|
|
84
|
+
captcha_type: Union[MtCaptchaTypeEnm, str],
|
|
83
85
|
websiteURL: str,
|
|
84
86
|
websiteKey: str,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
request_url: Optional[str] = REQUEST_URL,
|
|
87
|
+
*args,
|
|
88
|
+
**kwargs,
|
|
88
89
|
):
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
def captcha_handler(
|
|
103
|
-
self,
|
|
104
|
-
**additional_params,
|
|
105
|
-
) -> CaptchaResponseSer:
|
|
90
|
+
super().__init__(*args, **kwargs)
|
|
91
|
+
|
|
92
|
+
if captcha_type in MtCaptchaTypeEnm.list():
|
|
93
|
+
self.task_params = WebsiteDataOptionsSer(**locals()).dict()
|
|
94
|
+
else:
|
|
95
|
+
raise ValueError(
|
|
96
|
+
f"""Invalid `captcha_type` parameter set for `{self.__class__.__name__}`,
|
|
97
|
+
available - {MtCaptchaTypeEnm}"""
|
|
98
|
+
)
|
|
99
|
+
for key in kwargs:
|
|
100
|
+
self.task_params.update({key: kwargs[key]})
|
|
101
|
+
|
|
102
|
+
def captcha_handler(self) -> CaptchaResponseSer:
|
|
106
103
|
"""
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
Args:
|
|
110
|
-
additional_params: Some additional parameters that will be used in creating the task
|
|
111
|
-
and will be passed to the payload under ``task`` key.
|
|
112
|
-
Like ``isInvisible``, ``userAgent`` and etc. - more info in service docs
|
|
113
|
-
|
|
114
|
-
Examples:
|
|
115
|
-
>>> MtCaptcha(api_key="CAI-1324...",
|
|
116
|
-
... websiteURL="https://www.mtcaptcha.com/#mtcaptcha-demo",
|
|
117
|
-
... websiteKey="MTPublic-tqNCRE0GS",
|
|
118
|
-
... proxy="198.22.3.1:10001:user:pwd"
|
|
119
|
-
... ).captcha_handler()
|
|
120
|
-
CaptchaResponseSer(errorId=False,
|
|
121
|
-
errorCode=None,
|
|
122
|
-
errorDescription=None,
|
|
123
|
-
taskId='73bdcd28-6c77-4414-8....',
|
|
124
|
-
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
125
|
-
solution={'token': 'v1(03,79a,MTPublic-tqNCRE0GS,c9...'}
|
|
126
|
-
)
|
|
104
|
+
Sync method for captcha solving
|
|
127
105
|
|
|
128
106
|
Returns:
|
|
129
107
|
CaptchaResponseSer model with full service response
|
|
@@ -131,33 +109,11 @@ class MtCaptcha(BaseMtCaptcha):
|
|
|
131
109
|
Notes:
|
|
132
110
|
Check class docstring for more info
|
|
133
111
|
"""
|
|
134
|
-
return self._processing_captcha(
|
|
112
|
+
return self._processing_captcha(create_params=self.task_params)
|
|
135
113
|
|
|
136
|
-
async def aio_captcha_handler(
|
|
137
|
-
self,
|
|
138
|
-
**additional_params,
|
|
139
|
-
) -> CaptchaResponseSer:
|
|
114
|
+
async def aio_captcha_handler(self) -> CaptchaResponseSer:
|
|
140
115
|
"""
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
Args:
|
|
144
|
-
additional_params: Some additional parameters that will be used in creating the task
|
|
145
|
-
and will be passed to the payload under ``task`` key.
|
|
146
|
-
Like ``isInvisible``, ``userAgent`` and etc. - more info in service docs
|
|
147
|
-
|
|
148
|
-
Examples:
|
|
149
|
-
>>> await MtCaptcha(api_key="CAI-1324...",
|
|
150
|
-
... websiteURL="https://www.mtcaptcha.com/#mtcaptcha-demo",
|
|
151
|
-
... websiteKey="MTPublic-tqNCRE0GS",
|
|
152
|
-
... proxy="198.22.3.1:10001:user:pwd"
|
|
153
|
-
... ).aio_captcha_handler()
|
|
154
|
-
CaptchaResponseSer(errorId=False,
|
|
155
|
-
errorCode=None,
|
|
156
|
-
errorDescription=None,
|
|
157
|
-
taskId='73bdcd28-6c77-4414-8....',
|
|
158
|
-
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
159
|
-
solution={'token': 'v1(03,79a,MTPublic-tqNCRE0GS,c9...'}
|
|
160
|
-
)
|
|
116
|
+
Async method for captcha solving
|
|
161
117
|
|
|
162
118
|
Returns:
|
|
163
119
|
CaptchaResponseSer model with full service response
|
|
@@ -165,6 +121,4 @@ class MtCaptcha(BaseMtCaptcha):
|
|
|
165
121
|
Notes:
|
|
166
122
|
Check class docstring for more info
|
|
167
123
|
"""
|
|
168
|
-
return await self._aio_processing_captcha(
|
|
169
|
-
serializer=RequestCreateTaskSer, type=self.captcha_type, **additional_params
|
|
170
|
-
)
|
|
124
|
+
return await self._aio_processing_captcha(create_params=self.task_params)
|
python3_capsolver/recaptcha.py
CHANGED
|
@@ -58,6 +58,36 @@ class ReCaptcha(BaseCaptcha):
|
|
|
58
58
|
solution={'gRecaptchaResponse': '44795sds...'}
|
|
59
59
|
)
|
|
60
60
|
|
|
61
|
+
>>> ReCaptcha(api_key="CAI-1324...",
|
|
62
|
+
... captcha_type=ReCaptchaV3TypeEnm.ReCaptchaV3TaskProxyLess,
|
|
63
|
+
... websiteURL="https://2captcha.com/demo/recaptcha-v3",
|
|
64
|
+
... websiteKey="6LfB5_IbAAAAAMCtsjEHEHKqcB9iQocwwxTiihJu",
|
|
65
|
+
... pageAction="demo_action",
|
|
66
|
+
... proxy="socks5:192.191.100.10:4780:user:pwd"
|
|
67
|
+
... ).captcha_handler()
|
|
68
|
+
CaptchaResponseSer(errorId=False,
|
|
69
|
+
errorCode=None,
|
|
70
|
+
errorDescription=None,
|
|
71
|
+
taskId='73bdcd28-6c77-4414-8....',
|
|
72
|
+
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
73
|
+
solution={'gRecaptchaResponse': '44795sds...'}
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
>>> await ReCaptcha(api_key="CAI-1324...",
|
|
77
|
+
... captcha_type=ReCaptchaV3TypeEnm.ReCaptchaV3TaskProxyLess,
|
|
78
|
+
... websiteURL="https://2captcha.com/demo/recaptcha-v3",
|
|
79
|
+
... websiteKey="6LfB5_IbAAAAAMCtsjEHEHKqcB9iQocwwxTiihJu",
|
|
80
|
+
... pageAction="demo_action",
|
|
81
|
+
... proxy="socks5:192.191.100.10:4780:user:pwd"
|
|
82
|
+
... ).aio_captcha_handler()
|
|
83
|
+
CaptchaResponseSer(errorId=False,
|
|
84
|
+
errorCode=None,
|
|
85
|
+
errorDescription=None,
|
|
86
|
+
taskId='73bdcd28-6c77-4414-8....',
|
|
87
|
+
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
88
|
+
solution={'gRecaptchaResponse': '44795sds...'}
|
|
89
|
+
)
|
|
90
|
+
|
|
61
91
|
Returns:
|
|
62
92
|
CaptchaResponseSer model with full server response
|
|
63
93
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python3-capsolver
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.1
|
|
4
4
|
Summary: Python 3.7+ Capsolver library with AIO module.
|
|
5
5
|
Home-page: https://andreidrang.github.io/python3-capsolver/
|
|
6
6
|
Author: AndreiDrang
|
|
@@ -13,16 +13,19 @@ Keywords: captcha
|
|
|
13
13
|
geetest
|
|
14
14
|
hcaptcha
|
|
15
15
|
capypuzzle
|
|
16
|
-
tiktok
|
|
17
16
|
rotatecaptcha
|
|
18
17
|
funcaptcha
|
|
19
18
|
keycaptcha
|
|
20
19
|
python3
|
|
21
20
|
python-library
|
|
22
21
|
capsolver
|
|
23
|
-
kasada
|
|
24
22
|
datadomeslider
|
|
23
|
+
datadome
|
|
25
24
|
mtcaptcha
|
|
25
|
+
turnstile
|
|
26
|
+
cloudflare
|
|
27
|
+
amazon
|
|
28
|
+
amazon_waf
|
|
26
29
|
Classifier: License :: OSI Approved :: MIT License
|
|
27
30
|
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
|
|
28
31
|
Classifier: Development Status :: 5 - Production/Stable
|
|
@@ -33,6 +36,7 @@ Classifier: Programming Language :: Python :: 3.7
|
|
|
33
36
|
Classifier: Programming Language :: Python :: 3.8
|
|
34
37
|
Classifier: Programming Language :: Python :: 3.9
|
|
35
38
|
Classifier: Programming Language :: Python :: 3.10
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
36
40
|
Classifier: Framework :: AsyncIO
|
|
37
41
|
Classifier: Operating System :: Unix
|
|
38
42
|
Classifier: Operating System :: Microsoft :: Windows
|
|
@@ -46,22 +50,23 @@ Requires-Dist: tenacity (==8.*)
|
|
|
46
50
|
|
|
47
51
|
|
|
48
52
|
# python3-capsolver
|
|
49
|
-

|
|
50
54
|
|
|
51
55
|
[](https://dashboard.capsolver.com/passport/register?inviteCode=kQTn-tG07Jb1)
|
|
52
56
|
|
|
53
|
-
[](https://badge.fury.io/py/python3-capsolver)
|
|
58
|
+
[](https://badge.fury.io/py/python3-capsolver)
|
|
59
|
+
[](https://pepy.tech/project/python3-capsolver)
|
|
56
60
|
|
|
57
|
-
[](https://www.codacy.com/gh/AndreiDrang/python3-
|
|
59
|
-
[](https://codeclimate.com/github/AndreiDrang/python3-capsolver/maintainability)
|
|
62
|
+
[](https://www.codacy.com/gh/AndreiDrang/python3-capsolver/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AndreiDrang/python3-capsolver&utm_campaign=Badge_Grade)
|
|
63
|
+
[](https://codecov.io/gh/AndreiDrang/python3-capsolver)
|
|
60
64
|
|
|
61
|
-
[](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/sphinx.yml)
|
|
66
|
+
[](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/build.yml)
|
|
67
|
+
[](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/install.yml)
|
|
68
|
+
[](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/test.yml)
|
|
69
|
+
[](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/lint.yml)
|
|
65
70
|
|
|
66
71
|
|
|
67
72
|
Python 3 library for [Capsolver](https://dashboard.capsolver.com/passport/register?inviteCode=kQTn-tG07Jb1) service API.
|
|
@@ -80,17 +85,17 @@ Or email python-captcha@pm.me
|
|
|
80
85
|
|
|
81
86
|
## How to install?
|
|
82
87
|
|
|
83
|
-
We recommend using the latest version of Python. `python3-
|
|
88
|
+
We recommend using the latest version of Python. `python3-capsolver` supports Python 3.7+.
|
|
84
89
|
|
|
85
90
|
### pip
|
|
86
91
|
|
|
87
92
|
```bash
|
|
88
|
-
pip install python3-
|
|
93
|
+
pip install python3-capsolver
|
|
89
94
|
```
|
|
90
95
|
|
|
91
96
|
## How to use?
|
|
92
97
|
|
|
93
|
-
Is described in the [documentation-website](https://andreidrang.github.io/python3-
|
|
98
|
+
Is described in the [documentation-website](https://andreidrang.github.io/python3-capsolver/).
|
|
94
99
|
|
|
95
100
|
|
|
96
101
|
## How to test?
|
|
@@ -98,6 +103,11 @@ Is described in the [documentation-website](https://andreidrang.github.io/python
|
|
|
98
103
|
1. You need set ``API_KEY`` in your environment(get this value from you account).
|
|
99
104
|
2. Run command ``make tests``, from root directory.
|
|
100
105
|
|
|
106
|
+
|
|
107
|
+
### Changelog
|
|
108
|
+
|
|
109
|
+
Check [releases page](https://github.com/AndreiDrang/python3-capsolver/releases).
|
|
110
|
+
|
|
101
111
|
### How to get API Key to work with the library
|
|
102
112
|
1. On the page - https://dashboard.capsolver.com/overview/user-center
|
|
103
113
|
2. Find it: 
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
python3_capsolver/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
python3_capsolver/__version__.py,sha256=baAcEjLSYFIeNZF51tOMmA_zAMhN8HvKael-UU-Ruec,22
|
|
3
|
+
python3_capsolver/cloudflare.py,sha256=q7-r8U2umfeEQvJX-sr5nn6lMA-lk2ls9a5x9GMSy2I,4919
|
|
4
|
+
python3_capsolver/control.py,sha256=hWVRIrY6KEivzY0VMErWjVAK_LTBnO-hGRU7T7M1D34,1958
|
|
5
|
+
python3_capsolver/datadome_slider.py,sha256=ZdOAtY9-mG_RhlQHnqrN_3VsjZWAdNBpV3CtMDZZg5Q,3923
|
|
6
|
+
python3_capsolver/fun_captcha.py,sha256=16n4E7ikd9kvG8YTo5u3EAEz7vaFX7TtTg95Kft9uh4,7880
|
|
7
|
+
python3_capsolver/gee_test.py,sha256=QvniW2knFTWvioBY5L7dAgewd7qI-oqlPReSUqEIg-0,4322
|
|
8
|
+
python3_capsolver/hcaptcha.py,sha256=dkVMKB3JVKLoaf1_FthUKnq_XC1JeWGvQUZoX66kEaA,4830
|
|
9
|
+
python3_capsolver/image_to_text.py,sha256=ExxfcuJXeeND5RS3x3zH9-boeOGSutHg2m9LlvjePds,6349
|
|
10
|
+
python3_capsolver/mt_captcha.py,sha256=Ws4rqs_J93sjMduRsEI42li1p2Ob_nuqUwlzFCay-G8,4972
|
|
11
|
+
python3_capsolver/recaptcha.py,sha256=RoKPVphBtlgkGIsiKcGvGu4cUVXPboSwECItQH_WXlA,6394
|
|
12
|
+
python3_capsolver/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
+
python3_capsolver/core/base.py,sha256=AkvvsTVuDZe-rtwmWZrLgBIvYS1vqwNjiGbMzLKJVmE,8722
|
|
14
|
+
python3_capsolver/core/config.py,sha256=8K3MuBgrcltIdiAvKtd1kFJcQ2cC8Tlor_4L03C-D0M,1008
|
|
15
|
+
python3_capsolver/core/enum.py,sha256=OaVZj1rBX7iePr-bKHuXfah_fgbaQn2iA03q8JjP6fU,3398
|
|
16
|
+
python3_capsolver/core/serializer.py,sha256=MUTl1BkZ1UzY8VL0_TiS0cFRbJwWPp9deD8s1k-qz4s,4381
|
|
17
|
+
python3_capsolver-0.6.1.dist-info/METADATA,sha256=MQoq7AxVkenMny2gS3TB_wkGJC_ot7xRbIlr4_NuyMk,5196
|
|
18
|
+
python3_capsolver-0.6.1.dist-info/WHEEL,sha256=ZL1lC_LiPDNRgDnOl2taCMc83aPEUZgHHv2h-LDgdiM,92
|
|
19
|
+
python3_capsolver-0.6.1.dist-info/top_level.txt,sha256=yws7CqjoBfrn2ebCkAQmEaVlZ-zhbtflqpCDwAEX4kI,18
|
|
20
|
+
python3_capsolver-0.6.1.dist-info/RECORD,,
|
python3_capsolver/kasada.py
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
from typing import Union, Optional
|
|
2
|
-
|
|
3
|
-
from python3_capsolver.core.base import BaseCaptcha
|
|
4
|
-
from python3_capsolver.core.enum import ProxyType
|
|
5
|
-
from python3_capsolver.core.config import REQUEST_URL
|
|
6
|
-
from python3_capsolver.core.serializer import KasadaOptionsSer, CaptchaResponseSer, RequestCreateTaskSer
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class BaseKasada(BaseCaptcha):
|
|
10
|
-
"""
|
|
11
|
-
The class is used to work with Capsolver AntiKasadaTask methods.
|
|
12
|
-
|
|
13
|
-
Args:
|
|
14
|
-
api_key: Capsolver API key
|
|
15
|
-
pageURL: Address of a webpage with Kasada
|
|
16
|
-
proxyType: Type of the proxy
|
|
17
|
-
proxyAddress: Proxy IP address IPv4/IPv6. Not allowed to use:
|
|
18
|
-
host names instead of IPs,
|
|
19
|
-
transparent proxies (where client IP is visible),
|
|
20
|
-
proxies from local networks (192.., 10.., 127...)
|
|
21
|
-
proxyPort: Proxy port.
|
|
22
|
-
proxyLogin: Login for proxy which requires authorizaiton (basic).
|
|
23
|
-
This isn’t required if you are using proxies authenticated by IP
|
|
24
|
-
proxyPassword: This isn’t required if you are using proxies authenticated by IP
|
|
25
|
-
sleep_time: The waiting time between requests to get the result of the Captcha
|
|
26
|
-
request_url: API address for sending requests
|
|
27
|
-
|
|
28
|
-
Examples:
|
|
29
|
-
>>> Kasada(api_key="CAI-1324...",
|
|
30
|
-
... pageURL="http://mywebsite.com/kasada",
|
|
31
|
-
... proxyType="http",
|
|
32
|
-
... proxyAddress="0.0.0.0",
|
|
33
|
-
... proxyPort=9090,
|
|
34
|
-
... proxyLogin="some_login",
|
|
35
|
-
... proxyPassword="some_password",
|
|
36
|
-
... ).captcha_handler()
|
|
37
|
-
CaptchaResponseSer(errorId=False,
|
|
38
|
-
errorCode=None,
|
|
39
|
-
errorDescription=None,
|
|
40
|
-
taskId='73bdcd28-6c77-4414-8....',
|
|
41
|
-
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
42
|
-
solution={
|
|
43
|
-
"x-kpsdk-ct": "",
|
|
44
|
-
"x-kpsdk-cd": "",
|
|
45
|
-
"user-agent": "Mozilla/5.0 (Windows NT 10...."
|
|
46
|
-
}
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
>>> Kasada(api_key="CAI-1324...",
|
|
50
|
-
... pageURL="http://mywebsite.com/kasada",
|
|
51
|
-
... proxyType="http",
|
|
52
|
-
... proxyAddress="0.0.0.0",
|
|
53
|
-
... proxyPort=9090,
|
|
54
|
-
... proxyLogin="some_login",
|
|
55
|
-
... proxyPassword="some_password",
|
|
56
|
-
... ).captcha_handler(userAgent="Mozilla/5.0 (pl.....")
|
|
57
|
-
CaptchaResponseSer(errorId=False,
|
|
58
|
-
errorCode=None,
|
|
59
|
-
errorDescription=None,
|
|
60
|
-
taskId='73bdcd28-6c77-4414-8....',
|
|
61
|
-
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
62
|
-
solution={
|
|
63
|
-
"x-kpsdk-ct": "",
|
|
64
|
-
"x-kpsdk-cd": "",
|
|
65
|
-
"user-agent": "Mozilla/5.0 (Windows NT 10...."
|
|
66
|
-
}
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
Returns:
|
|
70
|
-
CaptchaResponseSer model with full server response
|
|
71
|
-
|
|
72
|
-
Notes:
|
|
73
|
-
https://captchaai.atlassian.net/wiki/spaces/CAPTCHAAI/pages/426407
|
|
74
|
-
"""
|
|
75
|
-
|
|
76
|
-
def __init__(
|
|
77
|
-
self,
|
|
78
|
-
api_key: str,
|
|
79
|
-
pageURL: str,
|
|
80
|
-
proxyType: Union[ProxyType, str],
|
|
81
|
-
proxyAddress: str,
|
|
82
|
-
proxyPort: int,
|
|
83
|
-
proxyLogin: str,
|
|
84
|
-
proxyPassword: str,
|
|
85
|
-
sleep_time: Optional[int] = 5,
|
|
86
|
-
request_url: Optional[str] = REQUEST_URL,
|
|
87
|
-
):
|
|
88
|
-
self.task_postfix = "/kasada/invoke"
|
|
89
|
-
|
|
90
|
-
super().__init__(api_key=api_key, sleep_time=sleep_time, request_url=request_url)
|
|
91
|
-
|
|
92
|
-
self.task_params = KasadaOptionsSer(**locals()).dict()
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
class Kasada(BaseKasada):
|
|
96
|
-
__doc__ = BaseKasada.__doc__
|
|
97
|
-
|
|
98
|
-
def captcha_handler(self, **additional_params) -> CaptchaResponseSer:
|
|
99
|
-
"""
|
|
100
|
-
Synchronous method for captcha solving
|
|
101
|
-
|
|
102
|
-
Args:
|
|
103
|
-
additional_params: Some additional parameters that will be used in creating the task
|
|
104
|
-
and will be passed to the payload under ``task`` key.
|
|
105
|
-
Like ``onlyCD``, ``userAgent`` and etc. - more info in service docs
|
|
106
|
-
|
|
107
|
-
Examples:
|
|
108
|
-
>>> Kasada(api_key="CAI-1324...",
|
|
109
|
-
... pageURL="http://mywebsite.com/kasada",
|
|
110
|
-
... proxyType="http",
|
|
111
|
-
... proxyAddress="0.0.0.0",
|
|
112
|
-
... proxyPort=9090,
|
|
113
|
-
... proxyLogin="some_login",
|
|
114
|
-
... proxyPassword="some_password",
|
|
115
|
-
... ).captcha_handler()
|
|
116
|
-
CaptchaResponseSer(errorId=False,
|
|
117
|
-
errorCode=None,
|
|
118
|
-
errorDescription=None,
|
|
119
|
-
taskId='73bdcd28-6c77-4414-8....',
|
|
120
|
-
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
121
|
-
solution={
|
|
122
|
-
"x-kpsdk-ct": "",
|
|
123
|
-
"x-kpsdk-cd": "",
|
|
124
|
-
"user-agent": "Mozilla/5.0 (Windows NT 10...."
|
|
125
|
-
}
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
Returns:
|
|
129
|
-
CaptchaResponseSer model with full service response
|
|
130
|
-
|
|
131
|
-
Notes:
|
|
132
|
-
Check class docstring for more info
|
|
133
|
-
"""
|
|
134
|
-
self.task_params.update({**additional_params})
|
|
135
|
-
self._prepare_create_task_payload(serializer=RequestCreateTaskSer, create_params=self.task_params)
|
|
136
|
-
return CaptchaResponseSer(**self._create_task(url_postfix=self.task_postfix))
|
|
137
|
-
|
|
138
|
-
async def aio_captcha_handler(self, **additional_params) -> CaptchaResponseSer:
|
|
139
|
-
"""
|
|
140
|
-
Asynchronous method for captcha solving
|
|
141
|
-
|
|
142
|
-
Args:
|
|
143
|
-
additional_params: Some additional parameters that will be used in creating the task
|
|
144
|
-
and will be passed to the payload under ``task`` key.
|
|
145
|
-
Like ``onlyCD``, ``userAgent`` and etc. - more info in service docs
|
|
146
|
-
|
|
147
|
-
Examples:
|
|
148
|
-
>>> await Kasada(api_key="CAI-1324...",
|
|
149
|
-
... pageURL="http://mywebsite.com/kasada",
|
|
150
|
-
... proxyType="http",
|
|
151
|
-
... proxyAddress="0.0.0.0",
|
|
152
|
-
... proxyPort=9090,
|
|
153
|
-
... proxyLogin="some_login",
|
|
154
|
-
... proxyPassword="some_password",
|
|
155
|
-
... ).aio_captcha_handler()
|
|
156
|
-
CaptchaResponseSer(errorId=False,
|
|
157
|
-
errorCode=None,
|
|
158
|
-
errorDescription=None,
|
|
159
|
-
taskId='73bdcd28-6c77-4414-8....',
|
|
160
|
-
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
161
|
-
solution={
|
|
162
|
-
"x-kpsdk-ct": "",
|
|
163
|
-
"x-kpsdk-cd": "",
|
|
164
|
-
"user-agent": "Mozilla/5.0 (Windows NT 10...."
|
|
165
|
-
}
|
|
166
|
-
)
|
|
167
|
-
|
|
168
|
-
Returns:
|
|
169
|
-
CaptchaResponseSer model with full service response
|
|
170
|
-
|
|
171
|
-
Notes:
|
|
172
|
-
Check class docstring for more info
|
|
173
|
-
"""
|
|
174
|
-
self.task_params.update({**additional_params})
|
|
175
|
-
self._prepare_create_task_payload(serializer=RequestCreateTaskSer, create_params=self.task_params)
|
|
176
|
-
return CaptchaResponseSer(**await self._aio_create_task(url_postfix=self.task_postfix))
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
python3_capsolver/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
python3_capsolver/__version__.py,sha256=KiyyYbyEe0O858kmiWcg1RdmqGUYtk_JqRmc3_Ev2Q8,22
|
|
3
|
-
python3_capsolver/control.py,sha256=k8_3jnfmLRKphfDD2_VgcJyX7kvsh9CIybzsC1P_cJc,2477
|
|
4
|
-
python3_capsolver/datadome_slider.py,sha256=kmlSSKVaTEr8EHQgvB67BbXOj0M4MS90MmmRkjljVso,6374
|
|
5
|
-
python3_capsolver/fun_captcha.py,sha256=16n4E7ikd9kvG8YTo5u3EAEz7vaFX7TtTg95Kft9uh4,7880
|
|
6
|
-
python3_capsolver/gee_test.py,sha256=SGMIFphY65KNrXV_8voKVKWdQCkn9xsbfPvUTCWQK5U,4323
|
|
7
|
-
python3_capsolver/hcaptcha.py,sha256=cCpZbsMah9qLHWu380pz17KLFM1H7QWAoV5dUvwBvVQ,4831
|
|
8
|
-
python3_capsolver/image_to_text.py,sha256=Nb5YdQHrxcahRBq39RcUIqKK2_oP1DoZTM8iaC4rqR8,6350
|
|
9
|
-
python3_capsolver/kasada.py,sha256=MOAJGdkflhNF9MK0-1QYqx2PcUJYDrp8hd_fJPIk-NU,7509
|
|
10
|
-
python3_capsolver/mt_captcha.py,sha256=SXScGHJ4el1fsj9jxslAXqYrbWoVrcpSxiKJZpK4vAs,7072
|
|
11
|
-
python3_capsolver/recaptcha.py,sha256=ZyEuBBQ7FuFuMCCDwTos7UKLec7K9u6hV0T_xfwTPbA,4780
|
|
12
|
-
python3_capsolver/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
python3_capsolver/core/base.py,sha256=5P3Wle11W0-CPElEqX1ZEEry_wz0omWzBLKj_Xm3zsw,8850
|
|
14
|
-
python3_capsolver/core/config.py,sha256=8K3MuBgrcltIdiAvKtd1kFJcQ2cC8Tlor_4L03C-D0M,1008
|
|
15
|
-
python3_capsolver/core/enum.py,sha256=cVVe4jVoUZdunBnO3vNgLraoRVNQ6ZhWUCIfgIaHOyk,3489
|
|
16
|
-
python3_capsolver/core/serializer.py,sha256=ehQtJXVB18OYzoLYxKdauIReFgouzuu9zl6UMHUcXq8,4212
|
|
17
|
-
python3_capsolver-0.5.7.dist-info/METADATA,sha256=Arrcntg77bX07J7rNfc5z8-6VnptB5vjsw_9awbQa9Q,4832
|
|
18
|
-
python3_capsolver-0.5.7.dist-info/WHEEL,sha256=ZL1lC_LiPDNRgDnOl2taCMc83aPEUZgHHv2h-LDgdiM,92
|
|
19
|
-
python3_capsolver-0.5.7.dist-info/top_level.txt,sha256=yws7CqjoBfrn2ebCkAQmEaVlZ-zhbtflqpCDwAEX4kI,18
|
|
20
|
-
python3_capsolver-0.5.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|