python-rucaptcha 6.1.1__py3-none-any.whl → 6.1.2__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.
@@ -1 +1 @@
1
- __version__ = "6.1.1"
1
+ __version__ = "6.1.2"
@@ -144,3 +144,8 @@ class CoordinatesCaptchaEnm(str, MyEnum):
144
144
 
145
145
  class GridCaptchaEnm(str, MyEnum):
146
146
  GridTask = "GridTask"
147
+
148
+
149
+ class FriendlyCaptchaEnm(str, MyEnum):
150
+ FriendlyCaptchaTaskProxyless = "FriendlyCaptchaTaskProxyless"
151
+ FriendlyCaptchaTask = "FriendlyCaptchaTask"
@@ -0,0 +1,124 @@
1
+ from typing import Union
2
+
3
+ from .core.base import BaseCaptcha
4
+ from .core.enums import FriendlyCaptchaEnm
5
+
6
+
7
+ class FriendlyCaptcha(BaseCaptcha):
8
+ def __init__(
9
+ self,
10
+ websiteURL: str,
11
+ websiteKey: str,
12
+ method: Union[str, FriendlyCaptchaEnm] = FriendlyCaptchaEnm.FriendlyCaptchaTaskProxyless,
13
+ *args,
14
+ **kwargs,
15
+ ):
16
+ """
17
+ The class is used to work with Friendly Captcha.
18
+
19
+ Args:
20
+ rucaptcha_key: User API key
21
+ websiteURL: The full URL of target web page where the captcha is loaded. We do not open the page,
22
+ not a problem if it is available only for authenticated users
23
+ websiteKey: The value of `data-sitekey` attribute of captcha's `div` element on page.
24
+ method: Captcha type
25
+
26
+ Examples:
27
+ >>> FriendlyCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
28
+ ... websiteKey="2FZFEVS1FZCGQ9",
29
+ ... websiteURL="https://example.com",
30
+ ... method=FriendlyCaptchaEnm.FriendlyCaptchaTaskProxyless.value
31
+ ... ).captcha_handler()
32
+ {
33
+ "errorId":0,
34
+ "status":"ready",
35
+ "solution":{
36
+ "token":"PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v"
37
+ },
38
+ "cost":"0.00299",
39
+ "ip":"1.2.3.4",
40
+ "createTime":1692863536,
41
+ "endTime":1692863556,
42
+ "solveCount":1,
43
+ "taskId":75190409731
44
+ }
45
+
46
+ >>> FriendlyCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
47
+ ... websiteKey="2FZFEVS1FZCGQ9",
48
+ ... websiteURL="https://example.com",
49
+ ... method=FriendlyCaptchaEnm.FriendlyCaptchaTaskProxyless.value
50
+ ... ).captcha_handler()
51
+ {
52
+ "errorId":0,
53
+ "status":"ready",
54
+ "solution":{
55
+ "token":"PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v"
56
+ },
57
+ "cost":"0.00299",
58
+ "ip":"1.2.3.4",
59
+ "createTime":1692863536,
60
+ "endTime":1692863556,
61
+ "solveCount":1,
62
+ "taskId":75190409731
63
+ }
64
+
65
+ >>> await FriendlyCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
66
+ ... websiteKey="2FZFEVS1FZCGQ9",
67
+ ... websiteURL="https://example.com",
68
+ ... method=FriendlyCaptchaEnm.FriendlyCaptchaTaskProxyless.value
69
+ ... ).aio_captcha_handler()
70
+ {
71
+ "errorId":0,
72
+ "status":"ready",
73
+ "solution":{
74
+ "token":"PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v"
75
+ },
76
+ "cost":"0.00299",
77
+ "ip":"1.2.3.4",
78
+ "createTime":1692863536,
79
+ "endTime":1692863556,
80
+ "solveCount":1,
81
+ "taskId":75190409731
82
+ }
83
+
84
+ Returns:
85
+ Dict with full server response
86
+
87
+ Notes:
88
+ https://rucaptcha.com/api-docs/friendly-captcha
89
+ """
90
+ super().__init__(method=method, *args, **kwargs)
91
+
92
+ self.create_task_payload["task"].update({"websiteURL": websiteURL, "websiteKey": websiteKey})
93
+
94
+ # check user params
95
+ if method not in FriendlyCaptchaEnm.list_values():
96
+ raise ValueError(f"Invalid method parameter set, available - {FriendlyCaptchaEnm.list_values()}")
97
+
98
+ def captcha_handler(self, **kwargs) -> dict:
99
+ """
100
+ Sync solving method
101
+
102
+ Args:
103
+ kwargs: additional params for `requests` library
104
+
105
+ Returns:
106
+ Dict with full server response
107
+
108
+ Notes:
109
+ Check class docstirng for more info
110
+ """
111
+
112
+ return self._processing_response(**kwargs)
113
+
114
+ async def aio_captcha_handler(self) -> dict:
115
+ """
116
+ Async solving method
117
+
118
+ Returns:
119
+ Dict with full server response
120
+
121
+ Notes:
122
+ Check class docstirng for more info
123
+ """
124
+ return await self._aio_processing_response()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-rucaptcha
3
- Version: 6.1.1
3
+ Version: 6.1.2
4
4
  Summary: Python 3.9+ RuCaptcha library with AIO module.
5
5
  Home-page: https://andreidrang.github.io/python-rucaptcha/
6
6
  Author: AndreiDrang, redV0ID
@@ -34,6 +34,7 @@ Keywords: captcha
34
34
  turnstile
35
35
  amazon
36
36
  amazon_waf
37
+ friendly-captcha
37
38
  Classifier: License :: OSI Approved :: MIT License
38
39
  Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
39
40
  Classifier: Programming Language :: Python
@@ -1,5 +1,5 @@
1
1
  python_rucaptcha/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- python_rucaptcha/__version__.py,sha256=TogwtvfScmmY5i06w1pmsYL28pcWyPETM_YMFRujQQY,22
2
+ python_rucaptcha/__version__.py,sha256=YN8byPcjyQjphqvazTEzWioECzFuTCnjb_LQ7d7T_gw,22
3
3
  python_rucaptcha/amazon_waf.py,sha256=psEg-sym8xQlMPPto1ND_HE0vGV_SRRrDnsKuEbbxNA,3625
4
4
  python_rucaptcha/audio_captcha.py,sha256=Bp6-gF3cTnYL8aeY8k4D4Ii7zPqy1Qo2OFRooSEd0MQ,5600
5
5
  python_rucaptcha/bounding_box_captcha.py,sha256=JvJEU1Y0A1SVkJV9jEFgBQ7Nis-vFkTmfUBoHIeTinY,10648
@@ -10,6 +10,7 @@ python_rucaptcha/cutcaptcha.py,sha256=8FVoIoKyKXL-znpkJUscsR9Q4n-2nWGfBBpWUXTiQF
10
10
  python_rucaptcha/cyber_siara_captcha.py,sha256=P8oLkn3UZDuy3XjEyd59cK2QOHYesV6KQ5pMbw2deiA,3909
11
11
  python_rucaptcha/datadome_captcha.py,sha256=sf6VdBWB3S7xTCyy83odJTHZHQmi6a2TNSFSFnSh__Y,4140
12
12
  python_rucaptcha/draw_around_captcha.py,sha256=uUaVk--31p0xh6sqTxtRdtxl0F4ZQ9KeESpmqY1WPR0,11837
13
+ python_rucaptcha/friendly_captcha.py,sha256=c5sbhAHq5zPlk2-5gGcoPhjslEkBT24EtFip2S8cGao,4232
13
14
  python_rucaptcha/fun_captcha.py,sha256=hz-ulRnuzqyk8vAXaT52aZ_EyH_mf_VwauGVfjR8rV8,3496
14
15
  python_rucaptcha/gee_test.py,sha256=lxhqWm2uWWS_uQK5ufArjr-508pfecDYAEh4Ct-FthI,8583
15
16
  python_rucaptcha/grid_captcha.py,sha256=ssfl1BnBzxR1CHGdnjEG4wunTvEk9NvGIoiXQWHrt20,9001
@@ -25,10 +26,10 @@ python_rucaptcha/turnstile.py,sha256=VpmYGYJoRVX6NHipO6-g2U5EpwxZToAZRmULj4ReDD0
25
26
  python_rucaptcha/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
27
  python_rucaptcha/core/base.py,sha256=e_5e9q5xaEcz7Wi9l-chdxz5vPpOTm6PpblaBtMkMfw,9315
27
28
  python_rucaptcha/core/config.py,sha256=UHP9iAaW3VpVC_7eHz_ihkYWIMAA9t_UXERfs5LwKiM,553
28
- python_rucaptcha/core/enums.py,sha256=R2IacwO_DOCKmV3gsZ6d6_1ZVRW4A2Yr5hWDHzAmXRs,3397
29
+ python_rucaptcha/core/enums.py,sha256=eUTp5_bHdHvYpoyMP2uhM4G1ydESo-kkWSwfMxhGuLw,3552
29
30
  python_rucaptcha/core/result_handler.py,sha256=uaeRMGP8Sagi7_Vh845lpvNXuNy4nVwgRKOsCKf2vXI,2680
30
31
  python_rucaptcha/core/serializer.py,sha256=asJRFD14uwOXG8gaNqsfaukiPBbsxt4r0rDA7lCuNHk,1739
31
- python_rucaptcha-6.1.1.dist-info/METADATA,sha256=dxYWrOaBXPV9Np0bAWFfmDM4jBPp8pjRPak9-5Ck05Q,6694
32
- python_rucaptcha-6.1.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
33
- python_rucaptcha-6.1.1.dist-info/top_level.txt,sha256=Eu_atEB79Y7jCsfXPcXF5N8OLt6kKVbvhuRsI1BmSWM,17
34
- python_rucaptcha-6.1.1.dist-info/RECORD,,
32
+ python_rucaptcha-6.1.2.dist-info/METADATA,sha256=l-kQ-d57RFMdfl0jGLVeg87xctMPeDDGkVYvBb8rQY4,6715
33
+ python_rucaptcha-6.1.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
34
+ python_rucaptcha-6.1.2.dist-info/top_level.txt,sha256=Eu_atEB79Y7jCsfXPcXF5N8OLt6kKVbvhuRsI1BmSWM,17
35
+ python_rucaptcha-6.1.2.dist-info/RECORD,,