python-rucaptcha 6.1__tar.gz → 6.1.2__tar.gz

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 (41) hide show
  1. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/PKG-INFO +3 -2
  2. python-rucaptcha-6.1.2/python_rucaptcha/__version__.py +1 -0
  3. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/core/enums.py +5 -0
  4. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/core/serializer.py +5 -7
  5. python-rucaptcha-6.1.2/python_rucaptcha/friendly_captcha.py +124 -0
  6. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/gee_test.py +2 -10
  7. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha.egg-info/PKG-INFO +3 -2
  8. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha.egg-info/SOURCES.txt +1 -0
  9. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/setup.py +1 -0
  10. python-rucaptcha-6.1/python_rucaptcha/__version__.py +0 -1
  11. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/__init__.py +0 -0
  12. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/amazon_waf.py +0 -0
  13. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/audio_captcha.py +0 -0
  14. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/bounding_box_captcha.py +0 -0
  15. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/capy_puzzle.py +0 -0
  16. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/control.py +0 -0
  17. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/coordinates_captcha.py +0 -0
  18. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/core/__init__.py +0 -0
  19. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/core/base.py +0 -0
  20. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/core/config.py +0 -0
  21. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/core/result_handler.py +0 -0
  22. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/cutcaptcha.py +0 -0
  23. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/cyber_siara_captcha.py +0 -0
  24. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/datadome_captcha.py +0 -0
  25. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/draw_around_captcha.py +0 -0
  26. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/fun_captcha.py +0 -0
  27. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/grid_captcha.py +0 -0
  28. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/hcaptcha.py +0 -0
  29. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/image_captcha.py +0 -0
  30. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/key_captcha.py +0 -0
  31. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/lemin_captcha.py +0 -0
  32. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/mt_captcha.py +0 -0
  33. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/re_captcha.py +0 -0
  34. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/rotate_captcha.py +0 -0
  35. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/text_captcha.py +0 -0
  36. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha/turnstile.py +0 -0
  37. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha.egg-info/dependency_links.txt +0 -0
  38. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha.egg-info/not-zip-safe +0 -0
  39. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha.egg-info/requires.txt +0 -0
  40. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/python_rucaptcha.egg-info/top_level.txt +0 -0
  41. {python-rucaptcha-6.1 → python-rucaptcha-6.1.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-rucaptcha
3
- Version: 6.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
@@ -58,7 +59,7 @@ Requires-Dist: tenacity==8.2.*
58
59
 
59
60
  # python-rucaptcha
60
61
 
61
- ![Logo](https://red-panda-dev.xyz/media/images/RuCaptchaHigh.max-800x600.png)
62
+ ![Logo](https://red-panda-dev.xyz/media/images/RuCaptchaHigh_zkkPoYF.original.png)
62
63
 
63
64
  <a href="https://dashboard.capsolver.com/passport/register?inviteCode=kQTn-tG07Jb1">
64
65
  <img src="https://cdn.discordapp.com/attachments/1105172394655625306/1105180101802471575/20221207-160749.gif" alt="Capsolver's Banner">
@@ -0,0 +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"
@@ -20,11 +20,6 @@ class TaskSer(MyBaseModel):
20
20
  type: str
21
21
 
22
22
 
23
- class ErrorFieldsSer(Struct):
24
- errorCode: str = None
25
- errorDescription: str = None
26
-
27
-
28
23
  class CreateTaskBaseSer(MyBaseModel):
29
24
  clientKey: str
30
25
  task: TaskSer = {}
@@ -62,8 +57,7 @@ HTTP API Response
62
57
  """
63
58
 
64
59
 
65
- class GetTaskResultResponseSer(MyBaseModel, ErrorFieldsSer):
66
- errorId: int = 0
60
+ class GetTaskResultResponseSer(MyBaseModel):
67
61
  status: str = "ready"
68
62
  solution: dict = None
69
63
  cost: float = None
@@ -74,3 +68,7 @@ class GetTaskResultResponseSer(MyBaseModel, ErrorFieldsSer):
74
68
  taskId: int = None
75
69
  # control method params
76
70
  balance: float = None
71
+ # error info
72
+ errorId: int = 0
73
+ errorCode: str = None
74
+ errorDescription: str = None
@@ -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()
@@ -194,11 +194,7 @@ class GeeTest(BaseCaptcha):
194
194
  Notes:
195
195
  Check class docstirng for more info
196
196
  """
197
- if self.method == GeetestEnm.GeeTestTaskProxyless.value:
198
- if challenge is not None:
199
- self.create_task_payload["task"].update({"challenge": challenge})
200
- else:
201
- raise ValueError(f"For {self.method} challenge is required")
197
+ self.create_task_payload["task"].update({"challenge": challenge})
202
198
 
203
199
  return self._processing_response(**kwargs)
204
200
 
@@ -215,10 +211,6 @@ class GeeTest(BaseCaptcha):
215
211
  Notes:
216
212
  Check class docstirng for more info
217
213
  """
218
- if self.method == GeetestEnm.GeeTestTaskProxyless.value:
219
- if challenge is not None:
220
- self.create_task_payload["task"].update({"challenge": challenge})
221
- else:
222
- raise ValueError(f"For {self.method} challenge is required")
214
+ self.create_task_payload["task"].update({"challenge": challenge})
223
215
 
224
216
  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
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
@@ -58,7 +59,7 @@ Requires-Dist: tenacity==8.2.*
58
59
 
59
60
  # python-rucaptcha
60
61
 
61
- ![Logo](https://red-panda-dev.xyz/media/images/RuCaptchaHigh.max-800x600.png)
62
+ ![Logo](https://red-panda-dev.xyz/media/images/RuCaptchaHigh_zkkPoYF.original.png)
62
63
 
63
64
  <a href="https://dashboard.capsolver.com/passport/register?inviteCode=kQTn-tG07Jb1">
64
65
  <img src="https://cdn.discordapp.com/attachments/1105172394655625306/1105180101802471575/20221207-160749.gif" alt="Capsolver's Banner">
@@ -11,6 +11,7 @@ python_rucaptcha/cutcaptcha.py
11
11
  python_rucaptcha/cyber_siara_captcha.py
12
12
  python_rucaptcha/datadome_captcha.py
13
13
  python_rucaptcha/draw_around_captcha.py
14
+ python_rucaptcha/friendly_captcha.py
14
15
  python_rucaptcha/fun_captcha.py
15
16
  python_rucaptcha/gee_test.py
16
17
  python_rucaptcha/grid_captcha.py
@@ -115,6 +115,7 @@ setup(
115
115
  turnstile
116
116
  amazon
117
117
  amazon_waf
118
+ friendly-captcha
118
119
  """,
119
120
  python_requires=REQUIRES_PYTHON,
120
121
  zip_safe=False,
@@ -1 +0,0 @@
1
- __version__ = "6.1"