python-rucaptcha 5.3__py3-none-any.whl → 6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_rucaptcha/__version__.py +1 -1
- python_rucaptcha/amazon_waf.py +47 -56
- python_rucaptcha/audio_captcha.py +54 -101
- python_rucaptcha/capy_puzzle.py +64 -111
- python_rucaptcha/control.py +60 -290
- python_rucaptcha/core/base.py +104 -56
- python_rucaptcha/core/config.py +1 -1
- python_rucaptcha/core/enums.py +35 -36
- python_rucaptcha/core/result_handler.py +29 -56
- python_rucaptcha/core/serializer.py +47 -142
- python_rucaptcha/fun_captcha.py +51 -47
- python_rucaptcha/gee_test.py +125 -156
- python_rucaptcha/hcaptcha.py +45 -77
- python_rucaptcha/image_captcha.py +132 -156
- python_rucaptcha/key_captcha.py +14 -38
- python_rucaptcha/lemin_captcha.py +112 -0
- python_rucaptcha/re_captcha.py +95 -98
- python_rucaptcha/rotate_captcha.py +117 -94
- python_rucaptcha/text_captcha.py +59 -43
- python_rucaptcha/turnstile.py +51 -47
- {python_rucaptcha-5.3.dist-info → python_rucaptcha-6.0.dist-info}/METADATA +20 -12
- python_rucaptcha-6.0.dist-info/RECORD +26 -0
- {python_rucaptcha-5.3.dist-info → python_rucaptcha-6.0.dist-info}/WHEEL +1 -1
- python_rucaptcha/SocketAPI.py +0 -104
- python_rucaptcha/TikTokCaptcha.py +0 -59
- python_rucaptcha/lemin_cropped_captcha.py +0 -136
- python_rucaptcha/yandex_smart_captcha.py +0 -127
- python_rucaptcha-5.3.dist-info/RECORD +0 -29
- {python_rucaptcha-5.3.dist-info → python_rucaptcha-6.0.dist-info}/top_level.txt +0 -0
python_rucaptcha/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "
|
|
1
|
+
__version__ = "6.0"
|
python_rucaptcha/amazon_waf.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Union
|
|
2
|
+
|
|
1
3
|
from .core.base import BaseCaptcha
|
|
2
4
|
from .core.enums import AmazonWAFCaptchaEnm
|
|
3
5
|
|
|
@@ -5,11 +7,11 @@ from .core.enums import AmazonWAFCaptchaEnm
|
|
|
5
7
|
class AmazonWAF(BaseCaptcha):
|
|
6
8
|
def __init__(
|
|
7
9
|
self,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
websiteURL: str,
|
|
11
|
+
websiteKey: str,
|
|
10
12
|
iv: str,
|
|
11
13
|
context: str,
|
|
12
|
-
method: str = AmazonWAFCaptchaEnm.
|
|
14
|
+
method: Union[str, AmazonWAFCaptchaEnm] = AmazonWAFCaptchaEnm.AmazonTaskProxyless,
|
|
13
15
|
*args,
|
|
14
16
|
**kwargs,
|
|
15
17
|
):
|
|
@@ -18,74 +20,80 @@ class AmazonWAF(BaseCaptcha):
|
|
|
18
20
|
|
|
19
21
|
Args:
|
|
20
22
|
rucaptcha_key: User API key
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
websiteURL: Full URL of the captcha page
|
|
24
|
+
websiteKey: Key value from the page
|
|
23
25
|
iv: Value iv from the page
|
|
24
26
|
context: Value of context from page
|
|
25
27
|
method: Captcha type
|
|
26
28
|
|
|
27
29
|
Examples:
|
|
28
30
|
>>> AmazonWAF(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
29
|
-
...
|
|
30
|
-
...
|
|
31
|
+
... websiteURL="https://page-with-waf.com/",
|
|
32
|
+
... websiteKey="some-site-key",
|
|
31
33
|
... iv="some-iv-value",
|
|
32
34
|
... context="some-context-value").captcha_handler()
|
|
33
35
|
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
"errorId":0,
|
|
37
|
+
"status":"ready",
|
|
38
|
+
"solution":{
|
|
39
|
+
"captcha_voucher":"eyJ0eXAiO...oQjTnJlBvAW4",
|
|
40
|
+
"existing_token":"f8ab5749-f916-...5D8yAA39JtKVbw="
|
|
41
|
+
},
|
|
42
|
+
"cost":"0.00145",
|
|
43
|
+
"ip":"1.2.3.4",
|
|
44
|
+
"createTime":1692863536,
|
|
45
|
+
"endTime":1692863556,
|
|
46
|
+
"solveCount":0,
|
|
47
|
+
"taskId": 73243152973,
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
>>> AmazonWAF(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
41
|
-
...
|
|
42
|
-
...
|
|
51
|
+
... websiteURL="https://page-with-waf.com/",
|
|
52
|
+
... websiteKey="some-site-key",
|
|
43
53
|
... iv="some-iv-value",
|
|
44
54
|
... context="some-context-value").aio_captcha_handler()
|
|
45
55
|
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
"errorId":0,
|
|
57
|
+
"status":"ready",
|
|
58
|
+
"solution":{
|
|
59
|
+
"captcha_voucher":"eyJ0eXAiO...oQjTnJlBvAW4",
|
|
60
|
+
"existing_token":"f8ab5749-f916-...5D8yAA39JtKVbw="
|
|
61
|
+
},
|
|
62
|
+
"cost":"0.00145",
|
|
63
|
+
"ip":"1.2.3.4",
|
|
64
|
+
"createTime":1692863536,
|
|
65
|
+
"endTime":1692863556,
|
|
66
|
+
"solveCount":0,
|
|
67
|
+
"taskId": 73243152973,
|
|
50
68
|
}
|
|
51
69
|
|
|
52
70
|
Returns:
|
|
53
71
|
Dict with full server response
|
|
54
72
|
|
|
55
73
|
Notes:
|
|
56
|
-
https://rucaptcha.com/api-
|
|
74
|
+
https://rucaptcha.com/api-docs/amazon-aws-waf-captcha
|
|
57
75
|
"""
|
|
58
76
|
super().__init__(method=method, *args, **kwargs)
|
|
59
77
|
|
|
60
|
-
self.post_payload.update({"sitekey": sitekey, "pageurl": pageurl, "iv": iv, "context": context})
|
|
61
|
-
|
|
62
78
|
# check user params
|
|
63
79
|
if method not in AmazonWAFCaptchaEnm.list_values():
|
|
64
80
|
raise ValueError(f"Invalid method parameter set, available - {AmazonWAFCaptchaEnm.list_values()}")
|
|
81
|
+
# insert `gt` param to payload
|
|
82
|
+
self.create_task_payload["task"].update(
|
|
83
|
+
{
|
|
84
|
+
"websiteURL": websiteURL,
|
|
85
|
+
"websiteKey": websiteKey,
|
|
86
|
+
"iv": iv,
|
|
87
|
+
"context": context,
|
|
88
|
+
}
|
|
89
|
+
)
|
|
65
90
|
|
|
66
91
|
def captcha_handler(self, **kwargs) -> dict:
|
|
67
92
|
"""
|
|
68
93
|
Synchronous method for captcha solving
|
|
69
94
|
|
|
70
|
-
Examples:
|
|
71
|
-
>>> AmazonWAF(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
72
|
-
... pageurl="https://page-with-waf.com/",
|
|
73
|
-
... sitekey="some-site-key",
|
|
74
|
-
... iv="some-iv-value",
|
|
75
|
-
... context="some-context-value").captcha_handler()
|
|
76
|
-
{
|
|
77
|
-
'captchaSolve': 'eyJ0e......jNuSFqtyP4Ho',
|
|
78
|
-
'taskId': '7111111984',
|
|
79
|
-
'error': False,
|
|
80
|
-
'errorBody': None
|
|
81
|
-
}
|
|
82
|
-
|
|
83
95
|
Returns:
|
|
84
|
-
|
|
85
|
-
captchaSolve - captcha solution,
|
|
86
|
-
taskId - finds the ID of the task to solve the captcha,
|
|
87
|
-
error - False - if everything is fine, True - if there is an error,
|
|
88
|
-
errorBody - error name
|
|
96
|
+
Dict with full server response
|
|
89
97
|
|
|
90
98
|
Notes:
|
|
91
99
|
Check class docstirng for more info
|
|
@@ -97,25 +105,8 @@ class AmazonWAF(BaseCaptcha):
|
|
|
97
105
|
"""
|
|
98
106
|
Asynchronous method for captcha solving
|
|
99
107
|
|
|
100
|
-
Examples:
|
|
101
|
-
>>> await AmazonWAF(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
102
|
-
... pageurl="https://page-with-waf.com/",
|
|
103
|
-
... sitekey="some-site-key",
|
|
104
|
-
... iv="some-iv-value",
|
|
105
|
-
... context="some-context-value").aio_captcha_handler()
|
|
106
|
-
{
|
|
107
|
-
'captchaSolve': 'eyJ0e......jNuSFqtyP4Ho',
|
|
108
|
-
'taskId': '7111111984',
|
|
109
|
-
'error': False,
|
|
110
|
-
'errorBody': None
|
|
111
|
-
}
|
|
112
|
-
|
|
113
108
|
Returns:
|
|
114
|
-
|
|
115
|
-
captchaSolve - captcha solution,
|
|
116
|
-
taskId - finds the ID of the task to solve the captcha,
|
|
117
|
-
error - False - if everything is fine, True - if there is an error,
|
|
118
|
-
errorBody - error name
|
|
109
|
+
Dict with full server response
|
|
119
110
|
|
|
120
111
|
Notes:
|
|
121
112
|
Check class docstirng for more info
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import base64
|
|
2
1
|
import shutil
|
|
3
|
-
from typing import Optional
|
|
2
|
+
from typing import Union, Optional
|
|
4
3
|
|
|
5
4
|
from .core.base import BaseCaptcha
|
|
6
5
|
from .core.enums import SaveFormatsEnm, AudioCaptchaEnm
|
|
6
|
+
from .core.serializer import GetTaskResultResponseSer
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class AudioCaptcha(BaseCaptcha):
|
|
10
10
|
def __init__(
|
|
11
11
|
self,
|
|
12
|
-
save_format: str = SaveFormatsEnm.TEMP
|
|
12
|
+
save_format: Union[str, SaveFormatsEnm] = SaveFormatsEnm.TEMP,
|
|
13
13
|
audio_clearing: bool = True,
|
|
14
14
|
audio_path: str = "PythonRuCaptchaAudio",
|
|
15
15
|
lang: str = "en",
|
|
@@ -38,6 +38,17 @@ class AudioCaptcha(BaseCaptcha):
|
|
|
38
38
|
'errorBody': None
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
>>> with open("src/examples/mediacaptcha_audio/recaptcha_55914.mp3", "rb") as f:
|
|
42
|
+
... file_data = f.read()
|
|
43
|
+
>>> AudioCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122"
|
|
44
|
+
... ).captcha_handler(captcha_base64=file_data)
|
|
45
|
+
{
|
|
46
|
+
'captchaSolve': 'five five nine one four',
|
|
47
|
+
'taskId': 73243152973,
|
|
48
|
+
'error': False,
|
|
49
|
+
'errorBody': None
|
|
50
|
+
}
|
|
51
|
+
|
|
41
52
|
>>> await AudioCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
42
53
|
... lang='en'
|
|
43
54
|
... ).aio_captcha_handler(captcha_file='examples/mediacaptcha_audio/recaptcha_55914.mp3')
|
|
@@ -48,19 +59,31 @@ class AudioCaptcha(BaseCaptcha):
|
|
|
48
59
|
'errorBody': None
|
|
49
60
|
}
|
|
50
61
|
|
|
62
|
+
>>> with open("src/examples/mediacaptcha_audio/recaptcha_55914.mp3", "rb") as f:
|
|
63
|
+
... file_data = f.read()
|
|
64
|
+
>>> await AudioCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122"
|
|
65
|
+
... ).aio_captcha_handler(captcha_base64=file_data)
|
|
66
|
+
{
|
|
67
|
+
'captchaSolve': 'five five nine one four',
|
|
68
|
+
'taskId': 73243152973,
|
|
69
|
+
'error': False,
|
|
70
|
+
'errorBody': None
|
|
71
|
+
}
|
|
72
|
+
|
|
51
73
|
Returns:
|
|
52
74
|
Dict with full server response
|
|
53
75
|
|
|
54
76
|
Notes:
|
|
55
|
-
https://rucaptcha.com/api-
|
|
77
|
+
https://rucaptcha.com/api-docs/audio
|
|
56
78
|
"""
|
|
57
79
|
|
|
58
|
-
super().__init__(method=AudioCaptchaEnm.
|
|
80
|
+
super().__init__(method=AudioCaptchaEnm.AudioTask.value, *args, **kwargs)
|
|
59
81
|
self.save_format = save_format
|
|
60
82
|
self.audio_clearing = audio_clearing
|
|
61
83
|
self.audio_path = audio_path
|
|
84
|
+
self.result = GetTaskResultResponseSer()
|
|
62
85
|
|
|
63
|
-
self.
|
|
86
|
+
self.create_task_payload["task"].update({"lang": lang})
|
|
64
87
|
|
|
65
88
|
def captcha_handler(
|
|
66
89
|
self,
|
|
@@ -78,60 +101,25 @@ class AudioCaptcha(BaseCaptcha):
|
|
|
78
101
|
captcha_base64: Captcha file BASE64 info
|
|
79
102
|
kwargs: additional params for `requests` library
|
|
80
103
|
|
|
81
|
-
Examples:
|
|
82
|
-
>>> AudioCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
83
|
-
... lang='en'
|
|
84
|
-
... ).captcha_handler(captcha_file='examples/mediacaptcha_audio/recaptcha_55914.mp3')
|
|
85
|
-
{
|
|
86
|
-
'captchaSolve': 'five five nine one four',
|
|
87
|
-
'taskId': 73243152973,
|
|
88
|
-
'error': False,
|
|
89
|
-
'errorBody': None
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
>>> AudioCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
93
|
-
... lang='en'
|
|
94
|
-
... ).captcha_handler(captcha_link='http://some/link/address/recaptcha_55914.mp3')
|
|
95
|
-
{
|
|
96
|
-
'captchaSolve': 'five five nine one four',
|
|
97
|
-
'taskId': 73243152973,
|
|
98
|
-
'error': False,
|
|
99
|
-
'errorBody': None
|
|
100
|
-
}
|
|
101
|
-
|
|
102
104
|
Returns:
|
|
103
105
|
Dict with full server response
|
|
104
106
|
|
|
105
107
|
Notes:
|
|
106
108
|
Check class docstirng for more info
|
|
107
109
|
"""
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
self.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return self.result.dict()
|
|
122
|
-
|
|
123
|
-
# according to the value of the passed parameter, select the function to save the file
|
|
124
|
-
if self.save_format == SaveFormatsEnm.CONST.value:
|
|
125
|
-
self._file_const_saver(content, self.audio_path, file_extension="mp3")
|
|
126
|
-
self.post_payload.update({"body": base64.b64encode(content).decode("utf-8")})
|
|
127
|
-
|
|
128
|
-
else:
|
|
129
|
-
# if none of the parameters are passed
|
|
130
|
-
self.result.error = True
|
|
131
|
-
self.result.errorBody = self.NO_CAPTCHA_ERR
|
|
132
|
-
return self.result.dict()
|
|
133
|
-
|
|
134
|
-
return self._processing_response(**kwargs)
|
|
110
|
+
|
|
111
|
+
self._body_file_processing(
|
|
112
|
+
save_format=self.save_format,
|
|
113
|
+
file_path=self.audio_path,
|
|
114
|
+
file_extension="mp3",
|
|
115
|
+
captcha_link=captcha_link,
|
|
116
|
+
captcha_file=captcha_file,
|
|
117
|
+
captcha_base64=captcha_base64,
|
|
118
|
+
**kwargs,
|
|
119
|
+
)
|
|
120
|
+
if not self.result.errorId:
|
|
121
|
+
return self._processing_response(**kwargs)
|
|
122
|
+
return self.result.to_dict()
|
|
135
123
|
|
|
136
124
|
async def aio_captcha_handler(
|
|
137
125
|
self,
|
|
@@ -149,59 +137,24 @@ class AudioCaptcha(BaseCaptcha):
|
|
|
149
137
|
captcha_base64: Captcha file BASE64
|
|
150
138
|
kwargs: additional params for `aiohttp` library
|
|
151
139
|
|
|
152
|
-
Examples:
|
|
153
|
-
>>> await AudioCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
154
|
-
... lang='en'
|
|
155
|
-
... ).aio_captcha_handler(captcha_file='examples/mediacaptcha_audio/recaptcha_55914.mp3')
|
|
156
|
-
{
|
|
157
|
-
'captchaSolve': 'five five nine one four',
|
|
158
|
-
'taskId': 73243152973,
|
|
159
|
-
'error': False,
|
|
160
|
-
'errorBody': None
|
|
161
|
-
}
|
|
162
|
-
>>> await AudioCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
163
|
-
... lang='en'
|
|
164
|
-
... ).aio_captcha_handler(captcha_link='http://some/link/address/recaptcha_55914.mp3')
|
|
165
|
-
{
|
|
166
|
-
'captchaSolve': 'five five nine one four',
|
|
167
|
-
'taskId': 73243152973,
|
|
168
|
-
'error': False,
|
|
169
|
-
'errorBody': None
|
|
170
|
-
}
|
|
171
|
-
|
|
172
140
|
Returns:
|
|
173
141
|
Dict with full server response
|
|
174
142
|
|
|
175
143
|
Notes:
|
|
176
144
|
Check class docstirng for more info
|
|
177
145
|
"""
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
self.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
self.result.errorBody = str(error)
|
|
191
|
-
return self.result.dict()
|
|
192
|
-
|
|
193
|
-
# according to the value of the passed parameter, select the function to save the file
|
|
194
|
-
if self.save_format == SaveFormatsEnm.CONST.value:
|
|
195
|
-
self._file_const_saver(content, self.audio_path, file_extension="mp3")
|
|
196
|
-
self.post_payload.update({"body": base64.b64encode(content).decode("utf-8")})
|
|
197
|
-
|
|
198
|
-
else:
|
|
199
|
-
# if none of the parameters are passed
|
|
200
|
-
self.result.error = True
|
|
201
|
-
self.result.errorBody = self.NO_CAPTCHA_ERR
|
|
202
|
-
return self.result.dict()
|
|
203
|
-
|
|
204
|
-
return await self._aio_processing_response()
|
|
146
|
+
await self._aio_body_file_processing(
|
|
147
|
+
save_format=self.save_format,
|
|
148
|
+
file_path=self.audio_path,
|
|
149
|
+
file_extension="mp3",
|
|
150
|
+
captcha_link=captcha_link,
|
|
151
|
+
captcha_file=captcha_file,
|
|
152
|
+
captcha_base64=captcha_base64,
|
|
153
|
+
**kwargs,
|
|
154
|
+
)
|
|
155
|
+
if not self.result.errorId:
|
|
156
|
+
return await self._aio_processing_response()
|
|
157
|
+
return self.result.to_dict()
|
|
205
158
|
|
|
206
159
|
def __del__(self):
|
|
207
160
|
if self.save_format == SaveFormatsEnm.CONST.value and self.audio_clearing:
|
python_rucaptcha/capy_puzzle.py
CHANGED
|
@@ -1,131 +1,121 @@
|
|
|
1
|
+
from typing import Union
|
|
2
|
+
|
|
1
3
|
from .core.base import BaseCaptcha
|
|
2
4
|
from .core.enums import CapyPuzzleEnm
|
|
3
5
|
|
|
4
6
|
|
|
5
7
|
class CapyPuzzle(BaseCaptcha):
|
|
6
|
-
def __init__(
|
|
8
|
+
def __init__(
|
|
9
|
+
self,
|
|
10
|
+
websiteURL: str,
|
|
11
|
+
websiteKey: str,
|
|
12
|
+
method: Union[str, CapyPuzzleEnm] = CapyPuzzleEnm.CapyTaskProxyless,
|
|
13
|
+
*args,
|
|
14
|
+
**kwargs,
|
|
15
|
+
):
|
|
7
16
|
"""
|
|
8
17
|
The class is used to work with CapyPuzzle.
|
|
9
18
|
|
|
10
19
|
Args:
|
|
11
20
|
rucaptcha_key: User API key
|
|
12
|
-
|
|
13
|
-
|
|
21
|
+
websiteURL: Full URL of the captcha page
|
|
22
|
+
websiteKey: The value of the `captchakey` parameter you found in the code of the page
|
|
14
23
|
method: Captcha type
|
|
15
24
|
|
|
16
25
|
Examples:
|
|
17
26
|
>>> CapyPuzzle(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
18
|
-
...
|
|
19
|
-
...
|
|
20
|
-
... method=CapyPuzzleEnm.
|
|
27
|
+
... websiteKey="PUZZLE_Cme4hZLjuZRMYC3uh14C52D3uNms5w",
|
|
28
|
+
... websiteURL="https://www.capy.me/account/register/",
|
|
29
|
+
... method=CapyPuzzleEnm.CapyTaskProxyless.value,
|
|
21
30
|
... api_server="https://jp.api.capy.me/",
|
|
22
31
|
... version="puzzle",
|
|
23
32
|
... ).captcha_handler()
|
|
24
33
|
{
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
34
|
+
"errorId":0,
|
|
35
|
+
"status":"ready",
|
|
36
|
+
"solution":{
|
|
37
|
+
"captchakey":"PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v",
|
|
38
|
+
"challengekey":"qHAPtn68KTnXFM8VQ3mtYRtmy3cSKuHJ",
|
|
39
|
+
"answer":"0xax8ex0xax84x0xkx7qx0xux7gx0xx42x0x3ox42x0x3ox4cx",
|
|
40
|
+
"respKey":""
|
|
29
41
|
},
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
42
|
+
"cost":"0.00299",
|
|
43
|
+
"ip":"1.2.3.4",
|
|
44
|
+
"createTime":1692863536,
|
|
45
|
+
"endTime":1692863556,
|
|
46
|
+
"solveCount":1,
|
|
47
|
+
"taskId":75190409731
|
|
33
48
|
}
|
|
34
49
|
|
|
35
50
|
>>> CapyPuzzle(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
36
|
-
...
|
|
37
|
-
...
|
|
38
|
-
... method=CapyPuzzleEnm.
|
|
51
|
+
... websiteKey="PUZZLE_Cme4hZLjuZRMYC3uh14C52D3uNms5w",
|
|
52
|
+
... websiteURL="https://www.capy.me/account/register/",
|
|
53
|
+
... method=CapyPuzzleEnm.CapyTaskProxyless.value,
|
|
39
54
|
... api_server="https://jp.api.capy.me/",
|
|
40
55
|
... version="avatar",
|
|
41
56
|
... ).captcha_handler()
|
|
42
57
|
{
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
58
|
+
"errorId":0,
|
|
59
|
+
"status":"ready",
|
|
60
|
+
"solution":{
|
|
61
|
+
"captchakey":"PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v",
|
|
62
|
+
"challengekey":"qHAPtn68KTnXFM8VQ3mtYRtmy3cSKuHJ",
|
|
63
|
+
"answer":"0xax8ex0xax84x0xkx7qx0xux7gx0xx42x0x3ox42x0x3ox4cx",
|
|
64
|
+
"respKey":""
|
|
47
65
|
},
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
66
|
+
"cost":"0.00299",
|
|
67
|
+
"ip":"1.2.3.4",
|
|
68
|
+
"createTime":1692863536,
|
|
69
|
+
"endTime":1692863556,
|
|
70
|
+
"solveCount":1,
|
|
71
|
+
"taskId":75190409731
|
|
51
72
|
}
|
|
52
73
|
|
|
53
74
|
>>> CapyPuzzle(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
54
|
-
...
|
|
55
|
-
...
|
|
56
|
-
... method="
|
|
75
|
+
... websiteKey="PUZZLE_Cme4hZLjuZRMYC3uh14C52D3uNms5w",
|
|
76
|
+
... websiteURL="https://www.capy.me/account/register/",
|
|
77
|
+
... method="CapyTaskProxyless",
|
|
57
78
|
... api_server="https://jp.api.capy.me/",
|
|
58
79
|
... version="puzzle",
|
|
59
80
|
... ).captcha_handler()
|
|
60
81
|
{
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
82
|
+
"errorId":0,
|
|
83
|
+
"status":"ready",
|
|
84
|
+
"solution":{
|
|
85
|
+
"captchakey":"PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v",
|
|
86
|
+
"challengekey":"qHAPtn68KTnXFM8VQ3mtYRtmy3cSKuHJ",
|
|
87
|
+
"answer":"0xax8ex0xax84x0xkx7qx0xux7gx0xx42x0x3ox42x0x3ox4cx",
|
|
88
|
+
"respKey":""
|
|
65
89
|
},
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
90
|
+
"cost":"0.00299",
|
|
91
|
+
"ip":"1.2.3.4",
|
|
92
|
+
"createTime":1692863536,
|
|
93
|
+
"endTime":1692863556,
|
|
94
|
+
"solveCount":1,
|
|
95
|
+
"taskId":75190409731
|
|
69
96
|
}
|
|
70
97
|
|
|
71
98
|
Returns:
|
|
72
99
|
Dict with full server response
|
|
73
100
|
|
|
74
101
|
Notes:
|
|
75
|
-
https://rucaptcha.com/api-
|
|
102
|
+
https://rucaptcha.com/api-docs/capy-puzzle-captcha
|
|
76
103
|
"""
|
|
77
104
|
super().__init__(method=method, *args, **kwargs)
|
|
78
105
|
|
|
79
|
-
self.
|
|
106
|
+
self.create_task_payload["task"].update({"websiteURL": websiteURL, "websiteKey": websiteKey})
|
|
80
107
|
|
|
81
108
|
# check user params
|
|
82
109
|
if method not in CapyPuzzleEnm.list_values():
|
|
83
110
|
raise ValueError(f"Invalid method parameter set, available - {CapyPuzzleEnm.list_values()}")
|
|
84
111
|
|
|
85
|
-
def captcha_handler(self, **kwargs):
|
|
112
|
+
def captcha_handler(self, **kwargs) -> dict:
|
|
86
113
|
"""
|
|
87
114
|
Sync solving method
|
|
88
115
|
|
|
89
116
|
Args:
|
|
90
117
|
kwargs: additional params for `requests` library
|
|
91
118
|
|
|
92
|
-
Examples:
|
|
93
|
-
>>> CapyPuzzle(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
94
|
-
... captchakey="PUZZLE_Cme4hZLjuZRMYC3uh14C52D3uNms5w",
|
|
95
|
-
... pageurl="https://www.capy.me/account/register/",
|
|
96
|
-
... method=CapyPuzzleEnm.CAPY.value,
|
|
97
|
-
... api_server="https://jp.api.capy.me/",
|
|
98
|
-
... version="puzzle",
|
|
99
|
-
... ).captcha_handler()
|
|
100
|
-
{
|
|
101
|
-
"captchaSolve": {
|
|
102
|
-
"captchakey": "PUZZLE_C...w",
|
|
103
|
-
"challengekey": "Uf....It",
|
|
104
|
-
"answer": "26x...x9mx"
|
|
105
|
-
},
|
|
106
|
-
"taskId": 73052314114,
|
|
107
|
-
"error": False,
|
|
108
|
-
"errorBody": None
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
>>> CapyPuzzle(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
112
|
-
... captchakey="PUZZLE_Cme4hZLjuZRMYC3uh14C52D3uNms5w",
|
|
113
|
-
... pageurl="https://www.capy.me/account/register/",
|
|
114
|
-
... method=CapyPuzzleEnm.CAPY.value,
|
|
115
|
-
... api_server="https://jp.api.capy.me/",
|
|
116
|
-
... version="avatar",
|
|
117
|
-
... ).captcha_handler()
|
|
118
|
-
{
|
|
119
|
-
"captchaSolve": {
|
|
120
|
-
"captchakey": "AVATART_C...w",
|
|
121
|
-
"challengekey": "Uf....It",
|
|
122
|
-
"answer": "26x...x9mx"
|
|
123
|
-
},
|
|
124
|
-
"taskId": 73052314114,
|
|
125
|
-
"error": False,
|
|
126
|
-
"errorBody": None
|
|
127
|
-
}
|
|
128
|
-
|
|
129
119
|
Returns:
|
|
130
120
|
Dict with full server response
|
|
131
121
|
|
|
@@ -135,47 +125,10 @@ class CapyPuzzle(BaseCaptcha):
|
|
|
135
125
|
|
|
136
126
|
return self._processing_response(**kwargs)
|
|
137
127
|
|
|
138
|
-
async def aio_captcha_handler(self):
|
|
128
|
+
async def aio_captcha_handler(self) -> dict:
|
|
139
129
|
"""
|
|
140
130
|
Async solving method
|
|
141
131
|
|
|
142
|
-
Examples:
|
|
143
|
-
>>> await CapyPuzzle(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
144
|
-
... captchakey="PUZZLE_Cme4hZLjuZRMYC3uh14C52D3uNms5w",
|
|
145
|
-
... pageurl="https://www.capy.me/account/register/",
|
|
146
|
-
... method=CapyPuzzleEnm.CAPY.value,
|
|
147
|
-
... api_server="https://jp.api.capy.me/",
|
|
148
|
-
... version="puzzle",
|
|
149
|
-
... ).aio_captcha_handler()
|
|
150
|
-
{
|
|
151
|
-
"captchaSolve": {
|
|
152
|
-
"captchakey": "PUZZLE_C...w",
|
|
153
|
-
"challengekey": "Uf....It",
|
|
154
|
-
"answer": "26x...x9mx"
|
|
155
|
-
},
|
|
156
|
-
"taskId": 73052314114,
|
|
157
|
-
"error": False,
|
|
158
|
-
"errorBody": None
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
>>> await CapyPuzzle(rucaptcha_key="aa9011f31111181111168611f1151122",
|
|
162
|
-
... captchakey="PUZZLE_Cme4hZLjuZRMYC3uh14C52D3uNms5w",
|
|
163
|
-
... pageurl="https://www.capy.me/account/register/",
|
|
164
|
-
... method=CapyPuzzleEnm.CAPY.value,
|
|
165
|
-
... api_server="https://jp.api.capy.me/",
|
|
166
|
-
... version="avatar",
|
|
167
|
-
... ).aio_captcha_handler()
|
|
168
|
-
{
|
|
169
|
-
"captchaSolve": {
|
|
170
|
-
"captchakey": "AVATART_C...w",
|
|
171
|
-
"challengekey": "Uf....It",
|
|
172
|
-
"answer": "26x...x9mx"
|
|
173
|
-
},
|
|
174
|
-
"taskId": 73052314114,
|
|
175
|
-
"error": False,
|
|
176
|
-
"errorBody": None
|
|
177
|
-
}
|
|
178
|
-
|
|
179
132
|
Returns:
|
|
180
133
|
Dict with full server response
|
|
181
134
|
|