python3-capsolver 0.9.4__py3-none-any.whl → 1.0.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/aws_waf.py +122 -95
- python3_capsolver/cloudflare.py +113 -96
- python3_capsolver/control.py +31 -29
- python3_capsolver/core/aio_captcha_instrument.py +109 -0
- python3_capsolver/core/base.py +49 -194
- python3_capsolver/core/captcha_instrument.py +145 -0
- python3_capsolver/core/const.py +27 -0
- python3_capsolver/core/context_instr.py +25 -0
- python3_capsolver/core/enum.py +21 -76
- python3_capsolver/core/serializer.py +35 -128
- python3_capsolver/core/sio_captcha_instrument.py +116 -0
- python3_capsolver/core/{config.py → utils.py} +1 -10
- python3_capsolver/datadome_slider.py +56 -84
- python3_capsolver/friendly_captcha.py +105 -0
- python3_capsolver/gee_test.py +58 -90
- python3_capsolver/image_to_text.py +86 -116
- python3_capsolver/mt_captcha.py +49 -108
- python3_capsolver/recaptcha.py +65 -129
- python3_capsolver/vision_engine.py +102 -0
- python3_capsolver/yandex.py +73 -0
- {python3_capsolver-0.9.4.dist-info → python3_capsolver-1.0.1.dist-info}/METADATA +12 -12
- python3_capsolver-1.0.1.dist-info/RECORD +28 -0
- {python3_capsolver-0.9.4.dist-info → python3_capsolver-1.0.1.dist-info}/WHEEL +1 -1
- python3_capsolver/akamai.py +0 -192
- python3_capsolver/binance.py +0 -112
- python3_capsolver/cyber_si_ara.py +0 -128
- python3_capsolver/fun_captcha.py +0 -251
- python3_capsolver/hcaptcha.py +0 -197
- python3_capsolver/imperva.py +0 -120
- python3_capsolver-0.9.4.dist-info/RECORD +0 -26
- {python3_capsolver-0.9.4.dist-info → python3_capsolver-1.0.1.dist-info}/LICENSE +0 -0
- {python3_capsolver-0.9.4.dist-info → python3_capsolver-1.0.1.dist-info}/top_level.txt +0 -0
python3_capsolver/mt_captcha.py
CHANGED
|
@@ -1,123 +1,64 @@
|
|
|
1
1
|
from typing import Union
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from python3_capsolver.core.serializer import CaptchaResponseSer, WebsiteDataOptionsSer
|
|
3
|
+
from .core.base import CaptchaParams
|
|
4
|
+
from .core.enum import CaptchaTypeEnm
|
|
6
5
|
|
|
6
|
+
__all__ = ("MtCaptcha",)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
class MtCaptcha(CaptchaParams):
|
|
9
10
|
"""
|
|
10
|
-
The class is used to work with Capsolver MtCaptcha
|
|
11
|
+
The class is used to work with Capsolver MtCaptcha captcha solving methods:
|
|
12
|
+
- MtCaptchaTask
|
|
13
|
+
- MtCaptchaTaskProxyLess
|
|
11
14
|
|
|
12
15
|
Args:
|
|
13
16
|
api_key: Capsolver API key
|
|
14
|
-
captcha_type: Captcha type name, like ``
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
captcha_type: Captcha type name, like ``MtCaptchaTaskProxyLess`` and etc.
|
|
18
|
+
kwargs: additional params for client, like captcha waiting time
|
|
19
|
+
available keys:
|
|
20
|
+
- sleep_time: int - captcha solution waintig time in sec
|
|
21
|
+
- request_url: str - API address for sending requests,
|
|
22
|
+
else official will be used
|
|
17
23
|
|
|
18
24
|
Examples:
|
|
19
|
-
>>> MtCaptcha
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...
|
|
23
|
-
...
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
... ).aio_captcha_handler()
|
|
52
|
-
CaptchaResponseSer(errorId=0,
|
|
53
|
-
errorCode=None,
|
|
54
|
-
errorDescription=None,
|
|
55
|
-
taskId='73bdcd28-6c77-4414-8....',
|
|
56
|
-
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
57
|
-
solution={'token': 'v1(03,79a,MTPublic-tqNCRE0GS,c9...'}
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
>>> await MtCaptcha(api_key="CAI-1324...",
|
|
61
|
-
... captcha_type=MtCaptchaTypeEnm.MtCaptchaTask,
|
|
62
|
-
... websiteURL="https://www.mtcaptcha.com/#mtcaptcha-demo",
|
|
63
|
-
... websiteKey="MTPublic-tqNCRE0GS",
|
|
64
|
-
... proxy="198.22.3.1:10001:user:pwd"
|
|
65
|
-
... ).aio_captcha_handler()
|
|
66
|
-
CaptchaResponseSer(errorId=0,
|
|
67
|
-
errorCode=None,
|
|
68
|
-
errorDescription=None,
|
|
69
|
-
taskId='73bdcd28-6c77-4414-8....',
|
|
70
|
-
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
71
|
-
solution={'token': 'v1(03,79a,MTPublic-tqNCRE0GS,c9...'}
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
Returns:
|
|
75
|
-
CaptchaResponseSer model with full server response
|
|
25
|
+
>>> from python3_capsolver.mt_captcha import MtCaptcha
|
|
26
|
+
>>> from python3_capsolver.core.enum import CaptchaTypeEnm
|
|
27
|
+
>>> MtCaptcha(api_key="CAI-12345....",
|
|
28
|
+
... captcha_type=CaptchaTypeEnm.MtCaptchaTaskProxyLess)
|
|
29
|
+
... .captcha_handler(task_payload={"websiteURL": "some-url"})
|
|
30
|
+
{
|
|
31
|
+
"errorId":0,
|
|
32
|
+
"errorCode":"None",
|
|
33
|
+
"errorDescription":"None",
|
|
34
|
+
"taskId":"db0a3153-621d-4f5e-8554-a1c032597ee7",
|
|
35
|
+
"status":"ready",
|
|
36
|
+
"solution":{
|
|
37
|
+
"token": ""
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
>>> import asyncio
|
|
42
|
+
>>> from python3_capsolver.mt_captcha import MtCaptcha
|
|
43
|
+
>>> from python3_capsolver.core.enum import CaptchaTypeEnm
|
|
44
|
+
>>> asyncio.run(MtCaptcha(api_key="CAI-12345....",
|
|
45
|
+
... captcha_type=CaptchaTypeEnm.MtCaptchaTaskProxyLess)
|
|
46
|
+
... .aio_captcha_handler(task_payload={"websiteURL": "some-url"}))
|
|
47
|
+
{
|
|
48
|
+
"errorId":0,
|
|
49
|
+
"errorCode":"None",
|
|
50
|
+
"errorDescription":"None",
|
|
51
|
+
"taskId":"db0a3153-621d-4f5e-8554-a1c032597ee7",
|
|
52
|
+
"status":"ready",
|
|
53
|
+
"solution":{
|
|
54
|
+
"token": ""
|
|
55
|
+
}
|
|
56
|
+
}
|
|
76
57
|
|
|
77
58
|
Notes:
|
|
78
|
-
https://docs.capsolver.com/guide/captcha/MtCaptcha
|
|
59
|
+
https://docs.capsolver.com/en/guide/captcha/MtCaptcha/
|
|
79
60
|
"""
|
|
80
61
|
|
|
81
|
-
def __init__(
|
|
82
|
-
self,
|
|
83
|
-
captcha_type: Union[MtCaptchaTypeEnm, str],
|
|
84
|
-
websiteURL: str,
|
|
85
|
-
websiteKey: str,
|
|
86
|
-
*args,
|
|
87
|
-
**kwargs,
|
|
88
|
-
):
|
|
89
|
-
super().__init__(*args, **kwargs)
|
|
90
|
-
|
|
91
|
-
if captcha_type in MtCaptchaTypeEnm.list():
|
|
92
|
-
self.task_params = WebsiteDataOptionsSer(**locals()).dict()
|
|
93
|
-
else:
|
|
94
|
-
raise ValueError(
|
|
95
|
-
f"""Invalid `captcha_type` parameter set for `{self.__class__.__name__}`,
|
|
96
|
-
available - {MtCaptchaTypeEnm}"""
|
|
97
|
-
)
|
|
98
|
-
for key in kwargs:
|
|
99
|
-
self.task_params.update({key: kwargs[key]})
|
|
100
|
-
|
|
101
|
-
def captcha_handler(self) -> CaptchaResponseSer:
|
|
102
|
-
"""
|
|
103
|
-
Sync method for captcha solving
|
|
104
|
-
|
|
105
|
-
Returns:
|
|
106
|
-
CaptchaResponseSer model with full service response
|
|
107
|
-
|
|
108
|
-
Notes:
|
|
109
|
-
Check class docstring for more info
|
|
110
|
-
"""
|
|
111
|
-
return self._processing_captcha(create_params=self.task_params)
|
|
112
|
-
|
|
113
|
-
async def aio_captcha_handler(self) -> CaptchaResponseSer:
|
|
114
|
-
"""
|
|
115
|
-
Async method for captcha solving
|
|
116
|
-
|
|
117
|
-
Returns:
|
|
118
|
-
CaptchaResponseSer model with full service response
|
|
62
|
+
def __init__(self, api_key: str, captcha_type: Union[CaptchaTypeEnm, str], **kwargs):
|
|
119
63
|
|
|
120
|
-
|
|
121
|
-
Check class docstring for more info
|
|
122
|
-
"""
|
|
123
|
-
return await self._aio_processing_captcha(create_params=self.task_params)
|
|
64
|
+
super().__init__(api_key=api_key, captcha_type=captcha_type, **kwargs)
|
python3_capsolver/recaptcha.py
CHANGED
|
@@ -1,145 +1,81 @@
|
|
|
1
|
-
from typing import Union
|
|
1
|
+
from typing import Union
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from python3_capsolver.core.serializer import ReCaptchaV3Ser, CaptchaResponseSer, WebsiteDataOptionsSer
|
|
3
|
+
from .core.base import CaptchaParams
|
|
4
|
+
from .core.enum import CaptchaTypeEnm
|
|
6
5
|
|
|
6
|
+
__all__ = ("ReCaptcha",)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
class ReCaptcha(CaptchaParams):
|
|
9
10
|
"""
|
|
10
|
-
The class is used to work with Capsolver ReCaptcha methods
|
|
11
|
+
The class is used to work with Capsolver ReCaptcha captcha solving methods:
|
|
12
|
+
- ReCaptchaV2Classification
|
|
13
|
+
- ReCaptchaV2Task
|
|
14
|
+
- ReCaptchaV2EnterpriseTask
|
|
15
|
+
- ReCaptchaV2TaskProxyLess
|
|
16
|
+
- ReCaptchaV2EnterpriseTaskProxyLess
|
|
17
|
+
- ReCaptchaV3Task
|
|
18
|
+
- ReCaptchaV3EnterpriseTask
|
|
19
|
+
- ReCaptchaV3TaskProxyLess
|
|
20
|
+
- ReCaptchaV3EnterpriseTaskProxyLess
|
|
11
21
|
|
|
12
22
|
Args:
|
|
13
23
|
api_key: Capsolver API key
|
|
14
24
|
captcha_type: Captcha type name, like ``ReCaptchaV2Task`` and etc.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
kwargs: additional params for client, like captcha waiting time
|
|
26
|
+
available keys:
|
|
27
|
+
- sleep_time: int - captcha solution waintig time in sec
|
|
28
|
+
- request_url: str - API address for sending requests,
|
|
29
|
+
else official will be used
|
|
19
30
|
|
|
20
31
|
Examples:
|
|
21
|
-
>>> ReCaptcha
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
)
|
|
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=0,
|
|
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=0,
|
|
84
|
-
errorCode=None,
|
|
85
|
-
errorDescription=None,
|
|
86
|
-
taskId='73bdcd28-6c77-4414-8....',
|
|
87
|
-
status=<ResponseStatusEnm.Ready: 'ready'>,
|
|
88
|
-
solution={'gRecaptchaResponse': '44795sds...'}
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
Returns:
|
|
92
|
-
CaptchaResponseSer model with full server response
|
|
32
|
+
>>> from python3_capsolver.recaptcha import ReCaptcha
|
|
33
|
+
>>> from python3_capsolver.core.enum import CaptchaTypeEnm
|
|
34
|
+
>>> from python3_capsolver.core.captcha_instrument import FileInstrument
|
|
35
|
+
>>> body = FileInstrument().file_processing(captcha_file="captcha_example.jpeg")
|
|
36
|
+
>>> ReCaptcha(api_key="CAI-12345....",
|
|
37
|
+
... captcha_type=CaptchaTypeEnm.ReCaptchaV2Classification)
|
|
38
|
+
... .captcha_handler(task_payload={"image": body, "question": "/m/04_sv"})
|
|
39
|
+
{
|
|
40
|
+
"errorId":0,
|
|
41
|
+
"errorCode":"None",
|
|
42
|
+
"errorDescription":"None",
|
|
43
|
+
"taskId":"db0a3153-621d-4f5e-8554-a1c032597ee7",
|
|
44
|
+
"status":"ready",
|
|
45
|
+
"solution":{
|
|
46
|
+
"confidence":0.9585,
|
|
47
|
+
"text":"gcphjd"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
>>> import asyncio
|
|
52
|
+
>>> from python3_capsolver.recaptcha import ReCaptcha
|
|
53
|
+
>>> from python3_capsolver.core.captcha_instrument import FileInstrument
|
|
54
|
+
>>> body = FileInstrument().file_processing(captcha_file="captcha_example.jpeg")
|
|
55
|
+
>>> asyncio.run(ReCaptcha(api_key="CAI-12345....").aio_captcha_handler(
|
|
56
|
+
... task_payload={"image": body, "question": "/m/04_sv"}
|
|
57
|
+
... )
|
|
58
|
+
... )
|
|
59
|
+
{
|
|
60
|
+
"errorId":0,
|
|
61
|
+
"errorCode":"None",
|
|
62
|
+
"errorDescription":"None",
|
|
63
|
+
"taskId":"db0a3153-621d-4f5e-8554-a1c032597ee7",
|
|
64
|
+
"status":"ready",
|
|
65
|
+
"solution":{
|
|
66
|
+
"confidence":0.9585,
|
|
67
|
+
"text":"gcphjd"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
93
70
|
|
|
94
71
|
Notes:
|
|
95
|
-
https://docs.capsolver.com/guide/
|
|
96
|
-
https://docs.capsolver.com/guide/captcha/ReCaptchaV3.html
|
|
97
|
-
"""
|
|
72
|
+
https://docs.capsolver.com/en/guide/recognition/ReCaptchaClassification/
|
|
98
73
|
|
|
99
|
-
|
|
100
|
-
self,
|
|
101
|
-
captcha_type: Union[ReCaptchaV2TypeEnm, ReCaptchaV3TypeEnm, str],
|
|
102
|
-
websiteURL: str,
|
|
103
|
-
websiteKey: str,
|
|
104
|
-
pageAction: Optional[str] = None,
|
|
105
|
-
*args,
|
|
106
|
-
**kwargs,
|
|
107
|
-
):
|
|
108
|
-
super().__init__(*args, **kwargs)
|
|
109
|
-
|
|
110
|
-
if captcha_type in ReCaptchaV2TypeEnm.list():
|
|
111
|
-
self.task_params = WebsiteDataOptionsSer(**locals()).dict()
|
|
112
|
-
elif captcha_type in ReCaptchaV3TypeEnm.list():
|
|
113
|
-
self.task_params = ReCaptchaV3Ser(**locals()).dict()
|
|
114
|
-
else:
|
|
115
|
-
raise ValueError(
|
|
116
|
-
f"""Invalid `captcha_type` parameter set for `{self.__class__.__name__}`,
|
|
117
|
-
available - {ReCaptchaV2TypeEnm.list(), ReCaptchaV3TypeEnm.list()}"""
|
|
118
|
-
)
|
|
119
|
-
for key in kwargs:
|
|
120
|
-
self.task_params.update({key: kwargs[key]})
|
|
121
|
-
|
|
122
|
-
def captcha_handler(self) -> CaptchaResponseSer:
|
|
123
|
-
"""
|
|
124
|
-
Sync method for captcha solving
|
|
125
|
-
|
|
126
|
-
Returns:
|
|
127
|
-
CaptchaResponseSer model with full service response
|
|
128
|
-
|
|
129
|
-
Notes:
|
|
130
|
-
Check class docstring for more info
|
|
131
|
-
"""
|
|
132
|
-
return self._processing_captcha(create_params=self.task_params)
|
|
133
|
-
|
|
134
|
-
async def aio_captcha_handler(self) -> CaptchaResponseSer:
|
|
135
|
-
"""
|
|
136
|
-
Async method for captcha solving
|
|
74
|
+
https://docs.capsolver.com/en/guide/captcha/ReCaptchaV2/
|
|
137
75
|
|
|
76
|
+
https://docs.capsolver.com/en/guide/captcha/ReCaptchaV3/
|
|
77
|
+
"""
|
|
138
78
|
|
|
139
|
-
|
|
140
|
-
CaptchaResponseSer model with full service response
|
|
79
|
+
def __init__(self, api_key: str, captcha_type: Union[CaptchaTypeEnm, str], **kwargs):
|
|
141
80
|
|
|
142
|
-
|
|
143
|
-
Check class docstring for more info
|
|
144
|
-
"""
|
|
145
|
-
return await self._aio_processing_captcha(create_params=self.task_params)
|
|
81
|
+
super().__init__(api_key=api_key, captcha_type=captcha_type, **kwargs)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
from typing import Any, Dict
|
|
2
|
+
|
|
3
|
+
from .core.base import CaptchaParams
|
|
4
|
+
from .core.enum import CaptchaTypeEnm
|
|
5
|
+
|
|
6
|
+
__all__ = ("VisionEngine",)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class VisionEngine(CaptchaParams):
|
|
10
|
+
"""
|
|
11
|
+
The class is used to work with Capsolver VisionEngine captcha solving method.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
api_key: Capsolver API key
|
|
15
|
+
kwargs: additional params for client, like captcha waiting time
|
|
16
|
+
available keys:
|
|
17
|
+
- sleep_time: int - captcha solution waintig time in sec
|
|
18
|
+
- request_url: str - API address for sending requests,
|
|
19
|
+
else official will be used
|
|
20
|
+
|
|
21
|
+
Examples:
|
|
22
|
+
>>> from python3_capsolver.vision_engine import VisionEngine
|
|
23
|
+
>>> from python3_capsolver.core.captcha_instrument import FileInstrument
|
|
24
|
+
>>> body = FileInstrument().file_processing(captcha_file="captcha_example.jpeg")
|
|
25
|
+
>>> VisionEngine(api_key="CAI-12345....").captcha_handler(
|
|
26
|
+
... task_payload={
|
|
27
|
+
... "image": body,
|
|
28
|
+
... "question": "click on the unique object",
|
|
29
|
+
... "module": "space_detection",
|
|
30
|
+
... }
|
|
31
|
+
... )
|
|
32
|
+
{
|
|
33
|
+
"errorId":0,
|
|
34
|
+
"errorCode":"None",
|
|
35
|
+
"errorDescription":"None",
|
|
36
|
+
"taskId":"db0a3153-621d-4f5e-8554-a1c032597ee7",
|
|
37
|
+
"status":"ready",
|
|
38
|
+
"solution":{
|
|
39
|
+
"box": [163.5, 107.5]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
>>> import asyncio
|
|
44
|
+
>>> from python3_capsolver.vision_engine import VisionEngine
|
|
45
|
+
>>> from python3_capsolver.core.captcha_instrument import FileInstrument
|
|
46
|
+
>>> body = FileInstrument().file_processing(captcha_file="captcha_example.jpeg")
|
|
47
|
+
>>> asyncio.run(VisionEngine(api_key="CAI-12345....").aio_captcha_handler(
|
|
48
|
+
... task_payload={
|
|
49
|
+
... "image": body,
|
|
50
|
+
... "question": "click on the unique object",
|
|
51
|
+
... "module": "space_detection",
|
|
52
|
+
... }
|
|
53
|
+
... ))
|
|
54
|
+
{
|
|
55
|
+
"errorId":0,
|
|
56
|
+
"errorCode":"None",
|
|
57
|
+
"errorDescription":"None",
|
|
58
|
+
"taskId":"db0a3153-621d-4f5e-8554-a1c032597ee7",
|
|
59
|
+
"status":"ready",
|
|
60
|
+
"solution":{
|
|
61
|
+
"box": [163.5, 107.5]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
Notes:
|
|
66
|
+
https://docs.capsolver.com/en/guide/recognition/VisionEngine/
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
def __init__(self, api_key: str, **kwargs):
|
|
70
|
+
super().__init__(api_key=api_key, captcha_type=CaptchaTypeEnm.VisionEngine, **kwargs)
|
|
71
|
+
|
|
72
|
+
def captcha_handler(self, task_payload: Dict) -> Dict[str, Any]:
|
|
73
|
+
"""
|
|
74
|
+
Synchronous method for captcha solving
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
task_payload: Captcha solving `task` payload, include `body`, `module` and other fields.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
Dict with full server response
|
|
81
|
+
|
|
82
|
+
Notes:
|
|
83
|
+
Check class docstring for more info
|
|
84
|
+
"""
|
|
85
|
+
task_payload.pop("type", None)
|
|
86
|
+
return super().captcha_handler(task_payload=task_payload)
|
|
87
|
+
|
|
88
|
+
async def aio_captcha_handler(self, task_payload: Dict) -> Dict[str, Any]:
|
|
89
|
+
"""
|
|
90
|
+
Asynchronous method for captcha solving
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
task_payload: Captcha solving `task` payload, include `question`, `image` and other fields.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Dict with full server response
|
|
97
|
+
|
|
98
|
+
Notes:
|
|
99
|
+
Check class docstring for more info
|
|
100
|
+
"""
|
|
101
|
+
task_payload.pop("type", None)
|
|
102
|
+
return await super().aio_captcha_handler(task_payload=task_payload)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from typing import Union
|
|
2
|
+
|
|
3
|
+
from .core.base import CaptchaParams
|
|
4
|
+
from .core.enum import CaptchaTypeEnm
|
|
5
|
+
|
|
6
|
+
__all__ = ("YandexCaptcha",)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class YandexCaptcha(CaptchaParams):
|
|
10
|
+
"""
|
|
11
|
+
The class is used to work with Capsolver YandexCaptchaTaskProxyLess methods.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
api_key: Capsolver API key
|
|
15
|
+
captcha_type: Captcha type name, like ``YandexCaptchaTaskProxyLess`` and etc.
|
|
16
|
+
kwargs: additional params for client, like captcha waiting time
|
|
17
|
+
available keys:
|
|
18
|
+
- sleep_time: int - captcha solution waintig time in sec
|
|
19
|
+
- request_url: str - API address for sending requests,
|
|
20
|
+
else official will be used
|
|
21
|
+
|
|
22
|
+
Examples:
|
|
23
|
+
>>> from python3_capsolver.core.enum import CaptchaTypeEnm
|
|
24
|
+
>>> from python3_capsolver.yandex import YandexCaptcha
|
|
25
|
+
>>> YandexCaptcha(api_key="CAP-XXXXX",
|
|
26
|
+
... captcha_type=CaptchaTypeEnm.YandexCaptchaTaskProxyLess,
|
|
27
|
+
... ).captcha_handler(task_payload={
|
|
28
|
+
... "websiteURL": "https://www.yourwebsite.com",
|
|
29
|
+
... "websiteKey": "ysc1_bFdbbET5WBnPTvoE5jTXxxxx"
|
|
30
|
+
... })
|
|
31
|
+
{
|
|
32
|
+
"errorId":0,
|
|
33
|
+
"errorCode":"None",
|
|
34
|
+
"errorDescription":"None",
|
|
35
|
+
"taskId":"db0a3153-621d-4f5e-8554-a1c032597ee7",
|
|
36
|
+
"status":"ready",
|
|
37
|
+
"solution":{
|
|
38
|
+
"token": "dD0xNzMzMjc0MjkzO2k9Nxxxx"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
>>> import asyncio
|
|
43
|
+
>>> from python3_capsolver.core.enum import CaptchaTypeEnm
|
|
44
|
+
>>> from python3_capsolver.yandex import YandexCaptcha
|
|
45
|
+
>>> asyncio.run(YandexCaptcha(api_key="CAP-XXXXX",
|
|
46
|
+
... captcha_type=CaptchaTypeEnm.YandexCaptchaTaskProxyLess,
|
|
47
|
+
... ).aio_captcha_handler(task_payload={
|
|
48
|
+
... "websiteURL": "https://www.yourwebsite.com",
|
|
49
|
+
... "websiteKey": "ysc1_bFdbbET5WBnPTvoE5jTXxxxx"
|
|
50
|
+
... }))
|
|
51
|
+
{
|
|
52
|
+
"errorId":0,
|
|
53
|
+
"errorCode":"None",
|
|
54
|
+
"errorDescription":"None",
|
|
55
|
+
"taskId":"db0a3153-621d-4f5e-8554-a1c032597ee7",
|
|
56
|
+
"status":"ready",
|
|
57
|
+
"solution":{
|
|
58
|
+
"token": "dD0xNzMzMjc0MjkzO2k9Nxxxx"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
Notes:
|
|
63
|
+
https://docs.capsolver.com/en/guide/captcha/YandexCaptcha/
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
def __init__(
|
|
67
|
+
self,
|
|
68
|
+
api_key: str,
|
|
69
|
+
captcha_type: Union[CaptchaTypeEnm, str] = CaptchaTypeEnm.YandexCaptchaTaskProxyLess,
|
|
70
|
+
**kwargs,
|
|
71
|
+
):
|
|
72
|
+
|
|
73
|
+
super().__init__(api_key=api_key, captcha_type=captcha_type, **kwargs)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: python3-capsolver
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: Python 3.8+ Capsolver library with AIO module.
|
|
5
5
|
Author-email: AndreiDrang <python-captcha@pm.me>
|
|
6
6
|
License: MIT License
|
|
@@ -30,18 +30,19 @@ Description-Content-Type: text/markdown
|
|
|
30
30
|
License-File: LICENSE
|
|
31
31
|
Requires-Dist: requests>=2.21.0
|
|
32
32
|
Requires-Dist: aiohttp>=3.9.2
|
|
33
|
-
Requires-Dist:
|
|
33
|
+
Requires-Dist: msgspec<0.20,>=0.18
|
|
34
34
|
Requires-Dist: tenacity<10,>=8
|
|
35
35
|
|
|
36
36
|
# python3-capsolver
|
|
37
37
|
|
|
38
|
-
](https://vyjava.xyz/dashboard/image/109278aa-961a-4503-bed0-0a9c838dcef2)
|
|
39
39
|
|
|
40
40
|
<hr>
|
|
41
41
|
|
|
42
42
|
[](https://badge.fury.io/py/python3-capsolver)
|
|
43
43
|
[](https://badge.fury.io/py/python3-capsolver)
|
|
44
44
|
[](https://pepy.tech/project/python3-capsolver)
|
|
45
|
+
[](https://andreidrang.github.io/python3-capsolver/)
|
|
45
46
|
|
|
46
47
|
[](https://codeclimate.com/github/AndreiDrang/python3-capsolver/maintainability)
|
|
47
48
|
[](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)
|
|
@@ -55,17 +56,10 @@ Requires-Dist: tenacity<10,>=8
|
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
Python 3 library for [Capsolver](https://dashboard.capsolver.com/passport/register?inviteCode=kQTn-tG07Jb1) service API.
|
|
58
|
-
|
|
59
59
|
Tested on UNIX based OS.
|
|
60
60
|
|
|
61
61
|
The library is intended for software developers and is used to work with the [Capsolver](https://dashboard.capsolver.com/passport/register?inviteCode=kQTn-tG07Jb1) service API.
|
|
62
62
|
|
|
63
|
-
***
|
|
64
|
-
|
|
65
|
-
If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.
|
|
66
|
-
|
|
67
|
-
Or email python-captcha@pm.me
|
|
68
|
-
|
|
69
63
|
## How to install?
|
|
70
64
|
|
|
71
65
|
We recommend using the latest version of Python. `python3-capsolver` supports Python 3.7+.
|
|
@@ -93,4 +87,10 @@ Check [releases page](https://github.com/AndreiDrang/python3-capsolver/releases)
|
|
|
93
87
|
|
|
94
88
|
### How to get API Key to work with the library
|
|
95
89
|
1. On the page - https://dashboard.capsolver.com/overview/user-center
|
|
96
|
-
2. Find it: 
|
|
90
|
+
2. Find it: [](https://vyjava.xyz/dashboard/image/ae8d4fbf-7451-441d-8984-79b1a7adbe27)
|
|
91
|
+
|
|
92
|
+
### Contacts
|
|
93
|
+
|
|
94
|
+
If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.
|
|
95
|
+
|
|
96
|
+
Or email python-captcha@pm.me
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
python3_capsolver/__init__.py,sha256=141uoiYvgRblIWZAy7AhQJz6iVqzY4b5cLxExIaKUlg,62
|
|
2
|
+
python3_capsolver/__version__.py,sha256=d4QHYmS_30j0hPN8NmNPnQ_Z0TphDRbu4MtQj9cT9e8,22
|
|
3
|
+
python3_capsolver/aws_waf.py,sha256=wwNjW2bkS-EdxEkTDxW9zwUGCnW_bbEhtruSgw_R94I,5677
|
|
4
|
+
python3_capsolver/cloudflare.py,sha256=SCuC4femAkNWY9taGELuGiGI8mDI5N2ziWAewNhAQrI,5367
|
|
5
|
+
python3_capsolver/control.py,sha256=QodZGEZcio2giwX8WvbVK20LvTRGmK5d_mqjBZFdncc,2083
|
|
6
|
+
python3_capsolver/datadome_slider.py,sha256=kh15W30CQl-RgzcyCm_2ldluYAvbjyTl3mS9SFGj51k,2805
|
|
7
|
+
python3_capsolver/friendly_captcha.py,sha256=S1nenBwG3P2hiB-In13tWMNnITou68s8q-h3QXplubI,4412
|
|
8
|
+
python3_capsolver/gee_test.py,sha256=VjBOVggAkVRx6pGRys8kXl0-ZLFNCOMSYK_Bn95zk7o,2903
|
|
9
|
+
python3_capsolver/image_to_text.py,sha256=BSOBkC9LQ7TMifnWPZtPH0-AMx74595UND8t1ZyIkRA,4228
|
|
10
|
+
python3_capsolver/mt_captcha.py,sha256=mtHyqGat34odh_2KLBviEHMxnFi3SSSvRaVQAE1k0HA,2267
|
|
11
|
+
python3_capsolver/recaptcha.py,sha256=tiZPC_OGfhA30SH6lnqo2curVDLDwGwGLvx1zVn3gYY,3052
|
|
12
|
+
python3_capsolver/vision_engine.py,sha256=Fegdtc1Gyrd-meQXu5I-7xh762kGGNy_E1TkawwbWUA,3791
|
|
13
|
+
python3_capsolver/yandex.py,sha256=4NvopCD9pKVyUNLlQqj2Yra3n_YY0NG8Gqc5sVK9Yis,2770
|
|
14
|
+
python3_capsolver/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
+
python3_capsolver/core/aio_captcha_instrument.py,sha256=NAMVky6mIY83nnzaBtsgpcpJEWlXS2BVarvJkRjwzSY,4620
|
|
16
|
+
python3_capsolver/core/base.py,sha256=KB8q_X4GuPawc1SuHDmoJeniKM73eFFkLhNW13sixmQ,3170
|
|
17
|
+
python3_capsolver/core/captcha_instrument.py,sha256=2lL_kqlTPoLaaMuS3Tib4ImeybYIOj4yEAxrFg9oeZI,5231
|
|
18
|
+
python3_capsolver/core/const.py,sha256=bY8bMw6XsxBuX4LRQ4mTxQmVnsgCWgoUVXTJlRLx3I4,803
|
|
19
|
+
python3_capsolver/core/context_instr.py,sha256=x3JQNd1ydlNdhuGKX_5gc-5Duq2pZJME0fs2YMQyGv4,503
|
|
20
|
+
python3_capsolver/core/enum.py,sha256=J5KSAOSHNy8Ivmv_yWcWORvavdorOtdZOOlfTohvFcE,2428
|
|
21
|
+
python3_capsolver/core/serializer.py,sha256=rE7VX_6FCisOnK-HS4K90LkuWU3cOVa6GwkvbFgjhnA,1342
|
|
22
|
+
python3_capsolver/core/sio_captcha_instrument.py,sha256=eRlGkZe6IZ-G0l6NnC0XUiaY_Lan364kNxun3kKuaA0,4505
|
|
23
|
+
python3_capsolver/core/utils.py,sha256=5PMxryy22MIUmUXPIHqz38vg2C2bqa7uXHUNYRF8DlY,633
|
|
24
|
+
python3_capsolver-1.0.1.dist-info/LICENSE,sha256=N_utAsqhTp1pXXp-PTE-CFMg5BfIIqTbF-phwwzOHeQ,1063
|
|
25
|
+
python3_capsolver-1.0.1.dist-info/METADATA,sha256=429EitBZCqwuLaWPHTo3E2RUO94QZfTO0UPn9BH6e3A,5348
|
|
26
|
+
python3_capsolver-1.0.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
27
|
+
python3_capsolver-1.0.1.dist-info/top_level.txt,sha256=yws7CqjoBfrn2ebCkAQmEaVlZ-zhbtflqpCDwAEX4kI,18
|
|
28
|
+
python3_capsolver-1.0.1.dist-info/RECORD,,
|