python3-capsolver 0.9.2__py3-none-any.whl → 1.0.0a0__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.
Files changed (34) hide show
  1. python3_capsolver/__init__.py +1 -0
  2. python3_capsolver/__version__.py +1 -1
  3. python3_capsolver/aws_waf.py +122 -95
  4. python3_capsolver/cloudflare.py +77 -96
  5. python3_capsolver/control.py +31 -29
  6. python3_capsolver/core/aio_captcha_instrument.py +109 -0
  7. python3_capsolver/core/base.py +52 -198
  8. python3_capsolver/core/captcha_instrument.py +145 -0
  9. python3_capsolver/core/const.py +27 -0
  10. python3_capsolver/core/context_instr.py +25 -0
  11. python3_capsolver/core/enum.py +21 -76
  12. python3_capsolver/core/serializer.py +35 -129
  13. python3_capsolver/core/sio_captcha_instrument.py +116 -0
  14. python3_capsolver/core/{config.py → utils.py} +1 -10
  15. python3_capsolver/datadome_slider.py +34 -84
  16. python3_capsolver/friendly_captcha.py +69 -0
  17. python3_capsolver/gee_test.py +58 -90
  18. python3_capsolver/image_to_text.py +86 -116
  19. python3_capsolver/mt_captcha.py +32 -108
  20. python3_capsolver/recaptcha.py +65 -129
  21. python3_capsolver/vision_engine.py +102 -0
  22. python3_capsolver/yandex.py +53 -0
  23. python3_capsolver-1.0.0a0.dist-info/LICENSE +21 -0
  24. {python3_capsolver-0.9.2.dist-info → python3_capsolver-1.0.0a0.dist-info}/METADATA +25 -55
  25. python3_capsolver-1.0.0a0.dist-info/RECORD +28 -0
  26. {python3_capsolver-0.9.2.dist-info → python3_capsolver-1.0.0a0.dist-info}/WHEEL +1 -1
  27. python3_capsolver/akamai.py +0 -192
  28. python3_capsolver/binance.py +0 -112
  29. python3_capsolver/cyber_si_ara.py +0 -128
  30. python3_capsolver/fun_captcha.py +0 -251
  31. python3_capsolver/hcaptcha.py +0 -197
  32. python3_capsolver/imperva.py +0 -120
  33. python3_capsolver-0.9.2.dist-info/RECORD +0 -25
  34. {python3_capsolver-0.9.2.dist-info → python3_capsolver-1.0.0a0.dist-info}/top_level.txt +0 -0
@@ -1,108 +1,76 @@
1
1
  from typing import Union
2
2
 
3
- from python3_capsolver.core.base import BaseCaptcha
4
- from python3_capsolver.core.enum import GeeTestCaptchaTypeEnm
5
- from python3_capsolver.core.serializer import GeeTestSer, CaptchaResponseSer
3
+ from .core.base import CaptchaParams
4
+ from .core.enum import CaptchaTypeEnm
6
5
 
6
+ __all__ = ("GeeTest",)
7
7
 
8
- class GeeTest(BaseCaptcha):
8
+
9
+ class GeeTest(CaptchaParams):
9
10
  """
10
- The class is used to work with Capsolver GeeTestTask methods.
11
+ The class is used to work with Capsolver GeeTestTaskProxyLess methods.
11
12
 
12
13
  Args:
13
14
  api_key: Capsolver API key
14
15
  captcha_type: Captcha type name, like ``GeeTestTaskProxyLess`` and etc.
15
- websiteURL: Address of a webpage with Geetest
16
- gt: The domain public key, rarely updated
17
- challenge: If you need to solve Geetest V3 you must use this parameter, don't need if you need to solve GeetestV4
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
18
21
 
19
22
  Examples:
20
- >>> GeeTest(api_key="CAI-1324...",
21
- ... captcha_type=GeeTestCaptchaTypeEnm.GeeTestTaskProxyLess,
22
- ... websiteURL="https://www.geetest.com/en/demo",
23
- ... gt="022397c99c9f646f6477822485f30404",
24
- ... challenge='12345678abc90123d45678ef90123a456b'
25
- ... ).captcha_handler()
26
- CaptchaResponseSer(errorId=0,
27
- errorCode=None,
28
- errorDescription=None,
29
- taskId='73bdcd28-6c77-4414-8....',
30
- status=<ResponseStatusEnm.Ready: 'ready'>,
31
- solution={'gRecaptchaResponse': '44795sds...'}
32
- )
33
-
34
- >>> GeeTest(api_key="CAI-1324...",
35
- ... captcha_type=GeeTestCaptchaTypeEnm.GeeTestTask,
36
- ... websiteURL="https://www.geetest.com/en/demo",
37
- ... gt="022397c99c9f646f6477822485f30404",
38
- ... challenge='12345678abc90123d45678ef90123a456b'
39
- ... proxy="socks5:192.191.100.10:4780:user:pwd"
40
- ... ).captcha_handler()
41
- CaptchaResponseSer(errorId=0,
42
- errorCode=None,
43
- errorDescription=None,
44
- taskId='73bdcd28-6c77-4414-8....',
45
- status=<ResponseStatusEnm.Ready: 'ready'>,
46
- solution={'gRecaptchaResponse': '44795sds...'}
47
- )
48
-
49
- >>> await GeeTest(api_key="CAI-1324...",
50
- ... captcha_type="GeetestTaskProxyless",
51
- ... websiteURL="https://www.geetest.com/en/demo",
52
- ... gt="022397c99c9f646f6477822485f30404",
53
- ... challenge='12345678abc90123d45678ef90123a456b'
54
- ... ).aio_captcha_handler()
55
- CaptchaResponseSer(errorId=0,
56
- errorCode=None,
57
- errorDescription=None,
58
- taskId='73bdcd28-6c77-4414-8....',
59
- status=<ResponseStatusEnm.Ready: 'ready'>,
60
- solution={'gRecaptchaResponse': '44795sds...'}
61
- )
62
-
63
-
64
- Returns:
65
- CaptchaResponseSer model with full server response
23
+ >>> from python3_capsolver.core.enum import CaptchaTypeEnm
24
+ >>> from python3_capsolver.gee_test import GeeTest
25
+
26
+ >>> GeeTest(api_key="CAP-XXXXX",
27
+ ... captcha_type=CaptchaTypeEnm.GeeTestTaskProxyLess,
28
+ ... ).captcha_handler(task_payload={
29
+ ... "websiteURL": "https://www.geetest.com/en/demo",
30
+ ... "gt": "022397c99c9f646f6477822485f30404",
31
+ ... "challenge": "12345678abc90123d45678ef90123a456b",
32
+ ... })
33
+ {
34
+ "errorId":0,
35
+ "errorCode":"None",
36
+ "errorDescription":"None",
37
+ "taskId":"db0a3153-621d-4f5e-8554-a1c032597ee7",
38
+ "status":"ready",
39
+ "solution":{
40
+ "challenge": "xxx",
41
+ "validate": "xxx"
42
+ }
43
+ }
44
+
45
+ >>> import asyncio
46
+ >>> from python3_capsolver.core.enum import CaptchaTypeEnm
47
+ >>> from python3_capsolver.gee_test import GeeTest
48
+
49
+ >>> asyncio.run(GeeTest(api_key="CAP-XXXXX",
50
+ ... captcha_type=CaptchaTypeEnm.GeeTestTaskProxyLess,
51
+ ... ).aio_captcha_handler(task_payload={
52
+ ... "websiteURL": "https://www.geetest.com/en/demo",
53
+ ... "gt": "022397c99c9f646f6477822485f30404",
54
+ ... "challenge": "12345678abc90123d45678ef90123a456b",
55
+ ... }))
56
+ {
57
+ "errorId":0,
58
+ "errorCode":"None",
59
+ "errorDescription":"None",
60
+ "taskId":"db0a3153-621d-4f5e-8554-a1c032597ee7",
61
+ "status":"ready",
62
+ "solution":{
63
+ "challenge": "xxx",
64
+ "validate": "xxx"
65
+ }
66
+ }
66
67
 
67
68
  Notes:
68
- https://docs.capsolver.com/guide/captcha/Geetest.html
69
+ https://docs.capsolver.com/en/guide/captcha/Geetest/
69
70
  """
70
71
 
71
72
  def __init__(
72
- self, captcha_type: Union[GeeTestCaptchaTypeEnm, str], websiteURL: str, gt: str, challenge: str, *args, **kwargs
73
+ self, api_key: str, captcha_type: Union[CaptchaTypeEnm, str] = CaptchaTypeEnm.GeeTestTaskProxyLess, **kwargs
73
74
  ):
74
- super().__init__(*args, **kwargs)
75
-
76
- if captcha_type in GeeTestCaptchaTypeEnm.list():
77
- self.task_params = GeeTestSer(**locals()).dict()
78
- else:
79
- raise ValueError(
80
- f"""Invalid `captcha_type` parameter set for `{self.__class__.__name__}`,
81
- available - {GeeTestCaptchaTypeEnm.list()}"""
82
- )
83
- for key in kwargs:
84
- self.task_params.update({key: kwargs[key]})
85
-
86
- def captcha_handler(self) -> CaptchaResponseSer:
87
- """
88
- Sync solving method
89
-
90
- Returns:
91
- CaptchaResponseSer model with full service response
92
-
93
- Notes:
94
- Check class docstring for more info
95
- """
96
- return self._processing_captcha(create_params=self.task_params)
97
-
98
- async def aio_captcha_handler(self) -> CaptchaResponseSer:
99
- """
100
- Async solving method
101
-
102
- Returns:
103
- CaptchaResponseSer model with full service response
104
75
 
105
- Notes:
106
- Check class docstring for more info
107
- """
108
- return await self._aio_processing_captcha(create_params=self.task_params)
76
+ super().__init__(api_key=api_key, captcha_type=captcha_type, **kwargs)
@@ -1,151 +1,121 @@
1
- from typing import Union
1
+ from typing import Dict
2
2
 
3
- from python3_capsolver.core.base import BaseCaptcha
4
- from python3_capsolver.core.enum import ImageToTextTaskTypeEnm
5
- from python3_capsolver.core.serializer import TaskSer, CaptchaResponseSer
3
+ from .core.base import CaptchaParams
4
+ from .core.enum import CaptchaTypeEnm
6
5
 
6
+ __all__ = ("ImageToText",)
7
7
 
8
- class ImageToText(BaseCaptcha):
8
+
9
+ class ImageToText(CaptchaParams):
9
10
  """
10
- The class is used to work with Capsolver Image captcha solving methods.
11
+ The class is used to work with Capsolver Image captcha solving method.
11
12
 
12
13
  Args:
13
14
  api_key: Capsolver API key
14
- captcha_type: Captcha type name, like ``ImageToTextTask`` and etc.
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
15
20
 
16
21
  Examples:
17
- >>> with open('some_image.jpeg', 'rb') as img_file:
18
- ... img_data = img_file.read()
19
- >>> body = base64.b64encode(img_data).decode("utf-8")
20
- >>> ImageToText(api_key="CAI-12345....").captcha_handler(body=body)
21
- CaptchaResponseSer(errorId=0,
22
- errorCode=None,
23
- errorDescription=None,
24
- taskId='73bdcd28-6c77-4414-8....',
25
- status=<ResponseStatusEnm.Ready: 'ready'>,
26
- solution={'confidence': 0.9585, 'text': 'gcphjd'}
27
- )
28
-
29
- >>> with open('some_image.jpeg', 'rb') as img_file:
30
- ... img_data = img_file.read()
31
- >>> body = base64.b64encode(img_data).decode("utf-8")
32
- >>> ImageToText(api_key="CAI-12345....",
33
- ... module='queueit'
34
- ... ).captcha_handler(body=body)
35
- CaptchaResponseSer(errorId=0,
36
- errorCode=None,
37
- errorDescription=None,
38
- taskId='73bdcd28-6c77-4414-8....',
39
- status=<ResponseStatusEnm.Ready: 'ready'>,
40
- solution={'confidence': 0.9585, 'text': 'zzzzz'}
41
- )
42
-
43
- >>> with open('some_image.jpeg', 'rb') as img_file:
44
- ... img_data = img_file.read()
45
- >>> body = base64.b64encode(img_data).decode("utf-8")
46
- >>> ImageToText(api_key="CAI-12345....",
47
- ... module='dell',
48
- ... score=0.98,
49
- ... case=True,
50
- ... ).captcha_handler(body=body)
51
- CaptchaResponseSer(errorId=0,
52
- errorCode=None,
53
- errorDescription=None,
54
- taskId='73bdcd28-6c77-4414-8....',
55
- status=<ResponseStatusEnm.Ready: 'ready'>,
56
- solution={'confidence': 0.9585, 'text': 'gcphjd'}
57
- )
58
-
59
- >>> with open('some_image.jpeg', 'rb') as img_file:
60
- ... img_data = img_file.read()
61
- >>> body = base64.b64encode(img_data).decode("utf-8")
62
- >>> with ImageToText(api_key="CAI-12345....") as image_to_text_inst:
63
- ... image_to_text_inst.captcha_handler(body=body)
64
- CaptchaResponseSer(errorId=0,
65
- errorCode=None,
66
- errorDescription=None,
67
- taskId='73bdcd28-6c77-4414-8....',
68
- status=<ResponseStatusEnm.Ready: 'ready'>,
69
- solution={'confidence': 0.9585, 'text': 'gcphjd'}
70
- )
71
-
72
- >>> with open('some_image.jpeg', 'rb') as img_file:
73
- ... img_data = img_file.read()
74
- >>> body = base64.b64encode(img_data).decode("utf-8")
75
- >>> await ImageToText(api_key="CAI-12345....").aio_captcha_handler(body=body)
76
- CaptchaResponseSer(errorId=0,
77
- errorCode=None,
78
- errorDescription=None,
79
- taskId='73bdcd28-6c77-4414-8....',
80
- status=<ResponseStatusEnm.Ready: 'ready'>,
81
- solution={'confidence': 0.9585, 'text': 'gcphjd'}
82
- )
83
-
84
- >>> with open('some_image.jpeg', 'rb') as img_file:
85
- ... img_data = img_file.read()
86
- >>> body = base64.b64encode(img_data).decode("utf-8")
87
- >>> with ImageToText(api_key="CAI-12345....") as image_to_text_inst:
88
- ... await image_to_text_inst.aio_captcha_handler(body=body)
89
- CaptchaResponseSer(errorId=0,
90
- errorCode=None,
91
- errorDescription=None,
92
- taskId='73bdcd28-6c77-4414-8....',
93
- status=<ResponseStatusEnm.Ready: 'ready'>,
94
- solution={'confidence': 0.9585, 'text': 'gcphjd'}
95
- )
96
-
97
- Returns:
98
- CaptchaResponseSer model with full server response
22
+ >>> from python3_capsolver.image_to_text import ImageToText
23
+ >>> from python3_capsolver.core.captcha_instrument import FileInstrument
24
+
25
+ >>> body = FileInstrument().file_processing(captcha_file="captcha_example.jpeg")
26
+ >>> ImageToText(api_key="CAI-12345....").captcha_handler(
27
+ ... task_payload={"body": body, "module": "common"}
28
+ ... )
29
+ {
30
+ "errorId":0,
31
+ "errorCode":"None",
32
+ "errorDescription":"None",
33
+ "taskId":"db0a3153-621d-4f5e-8554-a1c032597ee7",
34
+ "status":"ready",
35
+ "solution":{
36
+ "confidence":0.9585,
37
+ "text":"gcphjd"
38
+ }
39
+ }
40
+
41
+ >>> import asyncio
42
+ >>> from python3_capsolver.image_to_text import ImageToText
43
+ >>> from python3_capsolver.core.captcha_instrument import FileInstrument
44
+
45
+ >>> body = FileInstrument().file_processing(captcha_file="captcha_example.jpeg")
46
+ >>> asyncio.run(ImageToText(api_key="CAI-12345....").aio_captcha_handler(
47
+ ... task_payload={"body": body, "module": "common"}
48
+ ... )
49
+ ... )
50
+ {
51
+ "errorId":0,
52
+ "errorCode":"None",
53
+ "errorDescription":"None",
54
+ "taskId":"db0a3153-621d-4f5e-8554-a1c032597ee7",
55
+ "status":"ready",
56
+ "solution":{
57
+ "confidence":0.9585,
58
+ "text":"gcphjd"
59
+ }
60
+ }
61
+
62
+ >>> from python3_capsolver.image_to_text import ImageToText
63
+ >>> from python3_capsolver.core.captcha_instrument import FileInstrument
64
+
65
+ >>> body = FileInstrument().file_processing(captcha_file="captcha_example.jpeg")
66
+ >>> ImageToText(api_key="CAI-12345....").captcha_handler(
67
+ ... task_payload={"body": body,
68
+ ... "module": "common",
69
+ ... "score": 0.92}
70
+ ... )
71
+ {
72
+ "errorId":0,
73
+ "errorCode":"None",
74
+ "errorDescription":"None",
75
+ "taskId":"db0a3153-621d-4f5e-8554-a1c032597ee7",
76
+ "status":"ready",
77
+ "solution":{
78
+ "confidence":0.9585,
79
+ "text":"gcphjd"
80
+ }
81
+ }
99
82
 
100
83
  Notes:
101
84
  https://docs.capsolver.com/guide/recognition/ImageToTextTask.html
102
85
  """
103
86
 
104
- def __init__(
105
- self,
106
- captcha_type: Union[ImageToTextTaskTypeEnm, str] = ImageToTextTaskTypeEnm.ImageToTextTask,
107
- *args,
108
- **kwargs,
109
- ):
110
- super().__init__(*args, **kwargs)
111
- if captcha_type in ImageToTextTaskTypeEnm.list():
112
- self.task_params = TaskSer(**locals()).dict(exclude_none=True)
113
- else:
114
- raise ValueError(
115
- f"""Invalid `captcha_type` parameter set for `{self.__class__.__name__}`,
116
- available - {ImageToTextTaskTypeEnm.list()}"""
117
- )
118
- for key in kwargs:
119
- self.task_params.update({key: kwargs[key]})
120
-
121
- def captcha_handler(self, body: str) -> CaptchaResponseSer:
87
+ def __init__(self, api_key: str, **kwargs):
88
+
89
+ super().__init__(api_key=api_key, captcha_type=CaptchaTypeEnm.ImageToTextTask, **kwargs)
90
+
91
+ def captcha_handler(self, task_payload: Dict) -> Dict[str, str]:
122
92
  """
123
93
  Synchronous method for captcha solving
124
94
 
125
95
  Args:
126
- body: Base64 encoded content of the image, decoded into str
96
+ task_payload: Captcha solving `task` payload, include `body`, `module` and other fields.
127
97
 
128
98
  Returns:
129
- CaptchaResponseSer model with full server response
99
+ Dict with full server response
130
100
 
131
101
  Notes:
132
102
  Check class docstring for more info
133
103
  """
134
- self.task_params.update({"body": body})
135
- return self._processing_captcha(create_params=self.task_params)
104
+ task_payload.pop("type", None)
105
+ return super().captcha_handler(task_payload=task_payload)
136
106
 
137
- async def aio_captcha_handler(self, body: str) -> CaptchaResponseSer:
107
+ async def aio_captcha_handler(self, task_payload: Dict) -> Dict[str, str]:
138
108
  """
139
109
  Asynchronous method for captcha solving
140
110
 
141
111
  Args:
142
- body: Base64 encoded content of the image, decoded into str
112
+ task_payload: Captcha solving `task` payload, include `body`, `module` and other fields.
143
113
 
144
114
  Returns:
145
- CaptchaResponseSer model with full server response
115
+ Dict with full server response
146
116
 
147
117
  Notes:
148
118
  Check class docstring for more info
149
119
  """
150
- self.task_params.update({"body": body})
151
- return await self._aio_processing_captcha(create_params=self.task_params)
120
+ task_payload.pop("type", None)
121
+ return await super().aio_captcha_handler(task_payload=task_payload)
@@ -1,123 +1,47 @@
1
1
  from typing import Union
2
2
 
3
- from python3_capsolver.core.base import BaseCaptcha
4
- from python3_capsolver.core.enum import MtCaptchaTypeEnm
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
- class MtCaptcha(BaseCaptcha):
8
+
9
+ class MtCaptcha(CaptchaParams):
9
10
  """
10
- The class is used to work with Capsolver MtCaptcha method.
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 ``MtCaptchaTask`` and etc.
15
- websiteURL: Web address of the website using hcaptcha, generally it's fixed value. (Ex: https://google.com)
16
- websiteKey: The domain public key, rarely updated. (Ex: sk=MTPublic-xxx public key)
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(api_key="CAI-1324...",
20
- ... captcha_type=MtCaptchaTypeEnm.MtCaptchaTaskProxyLess,
21
- ... websiteURL="https://www.mtcaptcha.com/#mtcaptcha-demo",
22
- ... websiteKey="MTPublic-tqNCRE0GS",
23
- ... ).captcha_handler()
24
- CaptchaResponseSer(errorId=0,
25
- errorCode=None,
26
- errorDescription=None,
27
- taskId='73bdcd28-6c77-4414-8....',
28
- status=<ResponseStatusEnm.Ready: 'ready'>,
29
- solution={'token': 'v1(03,79a,MTPublic-tqNCRE0GS,c9...'}
30
- )
31
-
32
- >>> MtCaptcha(api_key="CAI-1324...",
33
- ... captcha_type=MtCaptchaTypeEnm.MtCaptchaTask,
34
- ... websiteURL="https://www.mtcaptcha.com/#mtcaptcha-demo",
35
- ... websiteKey="MTPublic-tqNCRE0GS",
36
- ... proxy="198.22.3.1:10001:user:pwd"
37
- ... ).captcha_handler()
38
- CaptchaResponseSer(errorId=0,
39
- errorCode=None,
40
- errorDescription=None,
41
- taskId='73bdcd28-6c77-4414-8....',
42
- status=<ResponseStatusEnm.Ready: 'ready'>,
43
- solution={'token': 'v1(03,79a,MTPublic-tqNCRE0GS,c9...'}
44
- )
45
-
46
- >>> await MtCaptcha(api_key="CAI-1324...",
47
- ... captcha_type=MtCaptchaTypeEnm.MtCaptchaTask,
48
- ... websiteURL="https://www.mtcaptcha.com/#mtcaptcha-demo",
49
- ... websiteKey="MTPublic-tqNCRE0GS",
50
- ... proxy="198.22.3.1:10001:user:pwd"
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
+ }
76
40
 
77
41
  Notes:
78
- https://docs.capsolver.com/guide/captcha/MtCaptcha.html
42
+ https://docs.capsolver.com/en/guide/captcha/MtCaptcha/
79
43
  """
80
44
 
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
45
+ def __init__(self, api_key: str, captcha_type: Union[CaptchaTypeEnm, str], **kwargs):
119
46
 
120
- Notes:
121
- Check class docstring for more info
122
- """
123
- return await self._aio_processing_captcha(create_params=self.task_params)
47
+ super().__init__(api_key=api_key, captcha_type=captcha_type, **kwargs)