Skip to content

Commit 2ede94b

Browse files
committed
v6.3.2
1 parent a3e599a commit 2ede94b

6 files changed

Lines changed: 121 additions & 1 deletion

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "6.3.1"
1+
__version__ = "6.3.2"

src/python_rucaptcha/atb_captcha.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def __init__(
7171
7272
Notes:
7373
https://rucaptcha.com/api-docs/atb-captcha
74+
7475
https://2captcha.com/api-docs/atb-captcha
7576
"""
7677
super().__init__(method=method, *args, **kwargs)

src/python_rucaptcha/control.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,15 @@ def __init__(
5555
5656
Notes:
5757
https://rucaptcha.com/api-docs/get-balance
58+
5859
https://rucaptcha.com/api-docs/report-correct
60+
5961
https://rucaptcha.com/api-docs/report-incorrect
62+
6063
https://2captcha.com/api-docs/get-balance
64+
6165
https://2captcha.com/api-docs/report-correct
66+
6267
https://2captcha.com/api-docs/report-incorrect
6368
"""
6469

src/python_rucaptcha/core/enums.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,8 @@ class TencentEnm(str, MyEnum):
159159
class atbCaptchaEnm(str, MyEnum):
160160
AtbCaptchaTask = "AtbCaptchaTask"
161161
AtbCaptchaTaskProxyless = "AtbCaptchaTaskProxyless"
162+
163+
164+
class ProsopoEnm(str, MyEnum):
165+
ProsopoTask = "ProsopoTask"
166+
ProsopoTaskProxyless = "ProsopoTaskProxyless "

src/python_rucaptcha/prosopo.py

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
from typing import Union
2+
3+
from .core.base import BaseCaptcha
4+
from .core.enums import ProsopoEnm
5+
6+
7+
class Prosopo(BaseCaptcha):
8+
def __init__(
9+
self,
10+
websiteURL: str,
11+
websiteKey: str,
12+
method: Union[str, ProsopoEnm] = ProsopoEnm.ProsopoTaskProxyless,
13+
*args,
14+
**kwargs,
15+
):
16+
"""
17+
The class is used to work with Prosopo.
18+
19+
Args:
20+
rucaptcha_key: User API key
21+
websiteURL: The full URL of target web page where the captcha is loaded.
22+
We do not open the page, not a problem if it is available
23+
only for authenticated users
24+
websiteKey: The value of `siteKey` parameter found on the page.
25+
method: Captcha type
26+
27+
Examples:
28+
>>> Prosopo(rucaptcha_key="aa9011f31111181111168611f1151122",
29+
... websiteURL="https://www.example.com/",
30+
... websiteKey="5EPQoMZEDc5LpN7gtxMMzYPTzA6UeWqL2stk1rso9gy4Ahqt",
31+
... method=ProsopoEnm.ProsopoTaskProxyless.value,
32+
... ).captcha_handler()
33+
{
34+
"errorId":0,
35+
"status":"ready",
36+
"solution":{
37+
"token": "0x00016c68747470733950547a4136",
38+
},
39+
"cost":"0.00299",
40+
"ip":"1.2.3.4",
41+
"createTime":1692863536,
42+
"endTime":1692863556,
43+
"solveCount":1,
44+
"taskId":75190409731
45+
}
46+
47+
>>> await Prosopo(rucaptcha_key="aa9011f31111181111168611f1151122",
48+
... websiteURL="https://www.example.com/",
49+
... websiteKey="5EPQoMZEDc5LpN7gtxMMzYPTzA6UeWqL2stk1rso9gy4Ahqt",
50+
... method=ProsopoEnm.ProsopoTaskProxyless.value,
51+
... ).aio_captcha_handler()
52+
{
53+
"errorId":0,
54+
"status":"ready",
55+
"solution":{
56+
"token": "0x00016c68747470733950547a4136",
57+
},
58+
"cost":"0.00299",
59+
"ip":"1.2.3.4",
60+
"createTime":1692863536,
61+
"endTime":1692863556,
62+
"solveCount":1,
63+
"taskId":75190409731
64+
}
65+
66+
Returns:
67+
Dict with full server response
68+
69+
Notes:
70+
https://rucaptcha.com/api-docs/prosopo-procaptcha
71+
72+
https://rucaptcha.com/api-docs/prosopo-procaptcha
73+
"""
74+
super().__init__(method=method, *args, **kwargs)
75+
76+
self.create_task_payload["task"].update({"websiteURL": websiteURL, "websiteKey": websiteKey})
77+
78+
# check user params
79+
if method not in ProsopoEnm.list_values():
80+
raise ValueError(f"Invalid method parameter set, available - {ProsopoEnm.list_values()}")
81+
82+
def captcha_handler(self, **kwargs) -> dict:
83+
"""
84+
Sync solving method
85+
86+
Args:
87+
kwargs: additional params for `requests` library
88+
89+
Returns:
90+
Dict with full server response
91+
92+
Notes:
93+
Check class docstirng for more info
94+
"""
95+
96+
return self._processing_response(**kwargs)
97+
98+
async def aio_captcha_handler(self) -> dict:
99+
"""
100+
Async solving method
101+
102+
Returns:
103+
Dict with full server response
104+
105+
Notes:
106+
Check class docstirng for more info
107+
"""
108+
return await self._aio_processing_response()

src/python_rucaptcha/tencent.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def __init__(
7474
7575
Notes:
7676
https://rucaptcha.com/api-docs/tencent
77+
7778
https://2captcha.com/api-docs/tencent
7879
"""
7980
super().__init__(method=method, *args, **kwargs)

0 commit comments

Comments
 (0)