python-rucaptcha 6.3__tar.gz → 6.3.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.
- {python_rucaptcha-6.3/src/python_rucaptcha.egg-info → python_rucaptcha-6.3.2}/PKG-INFO +15 -13
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/README.md +12 -10
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/pyproject.toml +3 -3
- python_rucaptcha-6.3.2/src/python_rucaptcha/__version__.py +1 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/atb_captcha.py +4 -1
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/control.py +5 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/core/base.py +16 -4
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/core/enums.py +5 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/core/result_handler.py +6 -2
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/cutcaptcha.py +3 -1
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/fun_captcha.py +3 -1
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/lemin_captcha.py +3 -1
- python_rucaptcha-6.3.2/src/python_rucaptcha/prosopo.py +108 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/tencent.py +1 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2/src/python_rucaptcha.egg-info}/PKG-INFO +15 -13
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha.egg-info/SOURCES.txt +1 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha.egg-info/requires.txt +1 -1
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_audio.py +3 -1
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_bounding_box.py +3 -1
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_coordinates.py +3 -1
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_draw_around.py +3 -1
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_funcaptcha.py +1 -3
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_geetest.py +3 -1
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_grid.py +3 -1
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_image.py +3 -1
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_mtcaptcha.py +4 -1
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_rotate.py +6 -2
- python_rucaptcha-6.3/src/python_rucaptcha/__version__.py +0 -1
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/LICENSE +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/MANIFEST.in +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/setup.cfg +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/__init__.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/amazon_waf.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/audio_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/bounding_box_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/capy_puzzle.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/coordinates_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/core/__init__.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/core/config.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/core/serializer.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/cyber_siara_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/datadome_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/draw_around_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/friendly_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/gee_test.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/grid_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/hcaptcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/image_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/key_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/mt_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/re_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/rotate_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/text_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/turnstile.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha.egg-info/dependency_links.txt +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha.egg-info/top_level.txt +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_amazon.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_capypuzzle.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_control.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_core.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_cutcaptcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_cybersiara.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_datadome.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_friendly_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_hcaptcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_key_captcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_lemin.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_recaptcha.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_tencent.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_text.py +0 -0
- {python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/tests/test_turnstile.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: python-rucaptcha
|
|
3
|
-
Version: 6.3
|
|
3
|
+
Version: 6.3.2
|
|
4
4
|
Summary: Python 3.9+ RuCaptcha library with AIO module.
|
|
5
5
|
Author-email: AndreiDrang <python-captcha@pm.me>
|
|
6
6
|
License: MIT License
|
|
@@ -29,22 +29,23 @@ Description-Content-Type: text/markdown
|
|
|
29
29
|
License-File: LICENSE
|
|
30
30
|
Requires-Dist: requests>=2.21.0
|
|
31
31
|
Requires-Dist: aiohttp>=3.9.2
|
|
32
|
-
Requires-Dist: msgspec
|
|
32
|
+
Requires-Dist: msgspec<0.20,>=0.18
|
|
33
33
|
Requires-Dist: tenacity<10,>=8
|
|
34
34
|
|
|
35
35
|
# python-rucaptcha
|
|
36
36
|
|
|
37
|
-
](https://vyjava.xyz/dashboard/image/45247a56-3332-48ee-8df8-fc95bcfc52f0)
|
|
38
38
|
|
|
39
39
|
### [Capsolver](https://www.capsolver.com/?utm_source=github&utm_medium=repo&utm_campaign=scraping&utm_term=python-rucaptcha)
|
|
40
40
|
|
|
41
|
-
[](https://www.capsolver.com/?utm_source=github&utm_medium=repo&utm_campaign=scraping&utm_term=python-rucaptcha)
|
|
42
42
|
|
|
43
43
|
<hr>
|
|
44
44
|
|
|
45
45
|
[](https://badge.fury.io/py/python-rucaptcha)
|
|
46
46
|
[](https://badge.fury.io/py/python-rucaptcha)
|
|
47
47
|
[](https://pepy.tech/project/python-rucaptcha)
|
|
48
|
+
[](https://andreidrang.github.io/python-rucaptcha/)
|
|
48
49
|
|
|
49
50
|
[](https://codeclimate.com/github/AndreiDrang/python-rucaptcha/maintainability)
|
|
50
51
|
[](https://www.codacy.com/gh/AndreiDrang/python-rucaptcha/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AndreiDrang/python-rucaptcha&utm_campaign=Badge_Grade)
|
|
@@ -56,21 +57,16 @@ Requires-Dist: tenacity<10,>=8
|
|
|
56
57
|
[](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/test.yml)
|
|
57
58
|
[](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/lint.yml)
|
|
58
59
|
|
|
59
|
-
Python3 library for [RuCaptcha](https://rucaptcha.com
|
|
60
|
+
Python3 library for [RuCaptcha](https://rucaptcha.com/?from=4170435) and [2Captcha](https://2captcha.com/?from=4170435) service API.
|
|
60
61
|
|
|
61
62
|
Tested on UNIX based OS.
|
|
62
63
|
|
|
63
|
-
The library is intended for software developers and is used to work with the [RuCaptcha](https://rucaptcha.com
|
|
64
|
+
The library is intended for software developers and is used to work with the [RuCaptcha](https://rucaptcha.com/?from=4170435) and [2Captcha](https://2captcha.com/?from=4170435) service API.
|
|
64
65
|
|
|
65
66
|
Support of the service [Death By Captcha](https://deathbycaptcha.com?refid=1237267242) is integrated into this library, more information in the library documentation or in the [service docs](https://deathbycaptcha.com/api/2captcha?refid=1237267242).
|
|
66
|
-
***
|
|
67
67
|
|
|
68
68
|
Application in [RuCaptcha software](https://rucaptcha.com/software/python-rucaptcha) and [2Captcha software](https://2captcha.com/software/python-rucaptcha).
|
|
69
69
|
|
|
70
|
-
If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.
|
|
71
|
-
|
|
72
|
-
Or email python-captcha@pm.me
|
|
73
|
-
|
|
74
70
|
## How to install?
|
|
75
71
|
|
|
76
72
|
### pip
|
|
@@ -103,4 +99,10 @@ For full changelog info check - [Releases page](https://github.com/AndreiDrang/p
|
|
|
103
99
|
|
|
104
100
|
### Get API Key to work with the library
|
|
105
101
|
1. On the page - https://rucaptcha.com/enterpage
|
|
106
|
-
2. Find it: ](https://vyjava.xyz/dashboard/image/ac679557-f3cc-402f-bf95-6c45d252a2ef)
|
|
103
|
+
|
|
104
|
+
### Contacts
|
|
105
|
+
|
|
106
|
+
If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.
|
|
107
|
+
|
|
108
|
+
Or email python-captcha@pm.me
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
# python-rucaptcha
|
|
2
2
|
|
|
3
|
-
](https://vyjava.xyz/dashboard/image/45247a56-3332-48ee-8df8-fc95bcfc52f0)
|
|
4
4
|
|
|
5
5
|
### [Capsolver](https://www.capsolver.com/?utm_source=github&utm_medium=repo&utm_campaign=scraping&utm_term=python-rucaptcha)
|
|
6
6
|
|
|
7
|
-
[](https://www.capsolver.com/?utm_source=github&utm_medium=repo&utm_campaign=scraping&utm_term=python-rucaptcha)
|
|
8
8
|
|
|
9
9
|
<hr>
|
|
10
10
|
|
|
11
11
|
[](https://badge.fury.io/py/python-rucaptcha)
|
|
12
12
|
[](https://badge.fury.io/py/python-rucaptcha)
|
|
13
13
|
[](https://pepy.tech/project/python-rucaptcha)
|
|
14
|
+
[](https://andreidrang.github.io/python-rucaptcha/)
|
|
14
15
|
|
|
15
16
|
[](https://codeclimate.com/github/AndreiDrang/python-rucaptcha/maintainability)
|
|
16
17
|
[](https://www.codacy.com/gh/AndreiDrang/python-rucaptcha/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AndreiDrang/python-rucaptcha&utm_campaign=Badge_Grade)
|
|
@@ -22,21 +23,16 @@
|
|
|
22
23
|
[](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/test.yml)
|
|
23
24
|
[](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/lint.yml)
|
|
24
25
|
|
|
25
|
-
Python3 library for [RuCaptcha](https://rucaptcha.com
|
|
26
|
+
Python3 library for [RuCaptcha](https://rucaptcha.com/?from=4170435) and [2Captcha](https://2captcha.com/?from=4170435) service API.
|
|
26
27
|
|
|
27
28
|
Tested on UNIX based OS.
|
|
28
29
|
|
|
29
|
-
The library is intended for software developers and is used to work with the [RuCaptcha](https://rucaptcha.com
|
|
30
|
+
The library is intended for software developers and is used to work with the [RuCaptcha](https://rucaptcha.com/?from=4170435) and [2Captcha](https://2captcha.com/?from=4170435) service API.
|
|
30
31
|
|
|
31
32
|
Support of the service [Death By Captcha](https://deathbycaptcha.com?refid=1237267242) is integrated into this library, more information in the library documentation or in the [service docs](https://deathbycaptcha.com/api/2captcha?refid=1237267242).
|
|
32
|
-
***
|
|
33
33
|
|
|
34
34
|
Application in [RuCaptcha software](https://rucaptcha.com/software/python-rucaptcha) and [2Captcha software](https://2captcha.com/software/python-rucaptcha).
|
|
35
35
|
|
|
36
|
-
If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.
|
|
37
|
-
|
|
38
|
-
Or email python-captcha@pm.me
|
|
39
|
-
|
|
40
36
|
## How to install?
|
|
41
37
|
|
|
42
38
|
### pip
|
|
@@ -69,4 +65,10 @@ For full changelog info check - [Releases page](https://github.com/AndreiDrang/p
|
|
|
69
65
|
|
|
70
66
|
### Get API Key to work with the library
|
|
71
67
|
1. On the page - https://rucaptcha.com/enterpage
|
|
72
|
-
2. Find it: ](https://vyjava.xyz/dashboard/image/ac679557-f3cc-402f-bf95-6c45d252a2ef)
|
|
69
|
+
|
|
70
|
+
### Contacts
|
|
71
|
+
|
|
72
|
+
If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.
|
|
73
|
+
|
|
74
|
+
Or email python-captcha@pm.me
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[tool.black]
|
|
2
|
-
line-length =
|
|
2
|
+
line-length = 110
|
|
3
3
|
target-version = ['py311']
|
|
4
4
|
exclude = '''
|
|
5
5
|
/(
|
|
@@ -18,7 +18,7 @@ exclude = '''
|
|
|
18
18
|
[tool.isort]
|
|
19
19
|
profile = "black"
|
|
20
20
|
skip_glob = "examples/**"
|
|
21
|
-
line_length =
|
|
21
|
+
line_length = 110
|
|
22
22
|
length_sort = true
|
|
23
23
|
|
|
24
24
|
[tool.pytest.ini_options]
|
|
@@ -88,7 +88,7 @@ classifiers = [
|
|
|
88
88
|
dependencies = [
|
|
89
89
|
"requests>=2.21.0",
|
|
90
90
|
"aiohttp>=3.9.2",
|
|
91
|
-
"msgspec
|
|
91
|
+
"msgspec>=0.18,<0.20",
|
|
92
92
|
"tenacity>=8,<10"
|
|
93
93
|
]
|
|
94
94
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "6.3.2"
|
|
@@ -71,11 +71,14 @@ class atbCaptcha(BaseCaptcha):
|
|
|
71
71
|
|
|
72
72
|
Notes:
|
|
73
73
|
https://rucaptcha.com/api-docs/atb-captcha
|
|
74
|
+
|
|
74
75
|
https://2captcha.com/api-docs/atb-captcha
|
|
75
76
|
"""
|
|
76
77
|
super().__init__(method=method, *args, **kwargs)
|
|
77
78
|
|
|
78
|
-
self.create_task_payload["task"].update(
|
|
79
|
+
self.create_task_payload["task"].update(
|
|
80
|
+
{"websiteURL": websiteURL, "appId": appId, "apiServer": apiServer}
|
|
81
|
+
)
|
|
79
82
|
|
|
80
83
|
# check user params
|
|
81
84
|
if method not in atbCaptchaEnm.list_values():
|
|
@@ -55,10 +55,15 @@ class Control(BaseCaptcha):
|
|
|
55
55
|
|
|
56
56
|
Notes:
|
|
57
57
|
https://rucaptcha.com/api-docs/get-balance
|
|
58
|
+
|
|
58
59
|
https://rucaptcha.com/api-docs/report-correct
|
|
60
|
+
|
|
59
61
|
https://rucaptcha.com/api-docs/report-incorrect
|
|
62
|
+
|
|
60
63
|
https://2captcha.com/api-docs/get-balance
|
|
64
|
+
|
|
61
65
|
https://2captcha.com/api-docs/report-correct
|
|
66
|
+
|
|
62
67
|
https://2captcha.com/api-docs/report-incorrect
|
|
63
68
|
"""
|
|
64
69
|
|
|
@@ -12,7 +12,13 @@ from requests.adapters import HTTPAdapter
|
|
|
12
12
|
|
|
13
13
|
from .enums import ServiceEnm, SaveFormatsEnm
|
|
14
14
|
from .config import RETRIES, ASYNC_RETRIES
|
|
15
|
-
from .serializer import
|
|
15
|
+
from .serializer import (
|
|
16
|
+
TaskSer,
|
|
17
|
+
CaptchaOptionsSer,
|
|
18
|
+
CreateTaskBaseSer,
|
|
19
|
+
GetTaskResultRequestSer,
|
|
20
|
+
GetTaskResultResponseSer,
|
|
21
|
+
)
|
|
16
22
|
from .result_handler import get_sync_result, get_async_result
|
|
17
23
|
|
|
18
24
|
|
|
@@ -79,7 +85,9 @@ class BaseCaptcha:
|
|
|
79
85
|
time.sleep(self.params.sleep_time)
|
|
80
86
|
|
|
81
87
|
return get_sync_result(
|
|
82
|
-
get_payload=self.get_task_payload,
|
|
88
|
+
get_payload=self.get_task_payload,
|
|
89
|
+
sleep_time=self.params.sleep_time,
|
|
90
|
+
url_response=self.params.url_response,
|
|
83
91
|
)
|
|
84
92
|
|
|
85
93
|
def url_open(self, url: str, **kwargs):
|
|
@@ -174,7 +182,9 @@ class BaseCaptcha:
|
|
|
174
182
|
)
|
|
175
183
|
# if the file is transferred in base64 encoding
|
|
176
184
|
elif captcha_base64:
|
|
177
|
-
self.create_task_payload["task"].update(
|
|
185
|
+
self.create_task_payload["task"].update(
|
|
186
|
+
{"body": base64.b64encode(captcha_base64).decode("utf-8")}
|
|
187
|
+
)
|
|
178
188
|
# if a URL is passed
|
|
179
189
|
elif captcha_link:
|
|
180
190
|
try:
|
|
@@ -209,7 +219,9 @@ class BaseCaptcha:
|
|
|
209
219
|
)
|
|
210
220
|
# if the file is transferred in base64 encoding
|
|
211
221
|
elif captcha_base64:
|
|
212
|
-
self.create_task_payload["task"].update(
|
|
222
|
+
self.create_task_payload["task"].update(
|
|
223
|
+
{"body": base64.b64encode(captcha_base64).decode("utf-8")}
|
|
224
|
+
)
|
|
213
225
|
# if a URL is passed
|
|
214
226
|
elif captcha_link:
|
|
215
227
|
try:
|
|
@@ -159,3 +159,8 @@ class TencentEnm(str, MyEnum):
|
|
|
159
159
|
class atbCaptchaEnm(str, MyEnum):
|
|
160
160
|
AtbCaptchaTask = "AtbCaptchaTask"
|
|
161
161
|
AtbCaptchaTaskProxyless = "AtbCaptchaTaskProxyless"
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class ProsopoEnm(str, MyEnum):
|
|
165
|
+
ProsopoTask = "ProsopoTask"
|
|
166
|
+
ProsopoTaskProxyless = "ProsopoTaskProxyless "
|
|
@@ -10,7 +10,9 @@ from .config import attempts_generator
|
|
|
10
10
|
from .serializer import GetTaskResultRequestSer, GetTaskResultResponseSer
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def get_sync_result(
|
|
13
|
+
def get_sync_result(
|
|
14
|
+
get_payload: GetTaskResultRequestSer, sleep_time: int, url_response: str
|
|
15
|
+
) -> Union[dict, Exception]:
|
|
14
16
|
"""
|
|
15
17
|
Function periodically send the SYNC request to service and wait for captcha solving result
|
|
16
18
|
"""
|
|
@@ -48,7 +50,9 @@ async def get_async_result(
|
|
|
48
50
|
for _ in attempts:
|
|
49
51
|
try:
|
|
50
52
|
# send a request for the result of solving the captcha
|
|
51
|
-
async with session.post(
|
|
53
|
+
async with session.post(
|
|
54
|
+
url_response, json=get_payload.to_dict(), raise_for_status=True
|
|
55
|
+
) as resp:
|
|
52
56
|
captcha_response = await resp.json(content_type=None)
|
|
53
57
|
captcha_response = GetTaskResultResponseSer(**captcha_response, taskId=get_payload.taskId)
|
|
54
58
|
|
|
@@ -81,7 +81,9 @@ class CutCaptcha(BaseCaptcha):
|
|
|
81
81
|
"""
|
|
82
82
|
super().__init__(method=method, *args, **kwargs)
|
|
83
83
|
|
|
84
|
-
self.create_task_payload["task"].update(
|
|
84
|
+
self.create_task_payload["task"].update(
|
|
85
|
+
{"websiteURL": websiteURL, "miseryKey": miseryKey, "apiKey": apiKey}
|
|
86
|
+
)
|
|
85
87
|
|
|
86
88
|
# check user params
|
|
87
89
|
if method not in CutCaptchaEnm.list_values():
|
|
@@ -69,7 +69,9 @@ class FunCaptcha(BaseCaptcha):
|
|
|
69
69
|
"""
|
|
70
70
|
super().__init__(method=method, *args, **kwargs)
|
|
71
71
|
|
|
72
|
-
self.create_task_payload["task"].update(
|
|
72
|
+
self.create_task_payload["task"].update(
|
|
73
|
+
{"websiteURL": websiteURL, "websitePublicKey": websitePublicKey}
|
|
74
|
+
)
|
|
73
75
|
|
|
74
76
|
# check user params
|
|
75
77
|
if method not in FunCaptchaEnm.list_values():
|
|
@@ -78,7 +78,9 @@ class LeminCaptcha(BaseCaptcha):
|
|
|
78
78
|
"""
|
|
79
79
|
super().__init__(method=method, *args, **kwargs)
|
|
80
80
|
|
|
81
|
-
self.create_task_payload["task"].update(
|
|
81
|
+
self.create_task_payload["task"].update(
|
|
82
|
+
{"websiteURL": websiteURL, "captchaId": captchaId, "div_id": div_id}
|
|
83
|
+
)
|
|
82
84
|
|
|
83
85
|
# check user params
|
|
84
86
|
if method not in LeminCaptchaEnm.list_values():
|
|
@@ -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()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: python-rucaptcha
|
|
3
|
-
Version: 6.3
|
|
3
|
+
Version: 6.3.2
|
|
4
4
|
Summary: Python 3.9+ RuCaptcha library with AIO module.
|
|
5
5
|
Author-email: AndreiDrang <python-captcha@pm.me>
|
|
6
6
|
License: MIT License
|
|
@@ -29,22 +29,23 @@ Description-Content-Type: text/markdown
|
|
|
29
29
|
License-File: LICENSE
|
|
30
30
|
Requires-Dist: requests>=2.21.0
|
|
31
31
|
Requires-Dist: aiohttp>=3.9.2
|
|
32
|
-
Requires-Dist: msgspec
|
|
32
|
+
Requires-Dist: msgspec<0.20,>=0.18
|
|
33
33
|
Requires-Dist: tenacity<10,>=8
|
|
34
34
|
|
|
35
35
|
# python-rucaptcha
|
|
36
36
|
|
|
37
|
-
](https://vyjava.xyz/dashboard/image/45247a56-3332-48ee-8df8-fc95bcfc52f0)
|
|
38
38
|
|
|
39
39
|
### [Capsolver](https://www.capsolver.com/?utm_source=github&utm_medium=repo&utm_campaign=scraping&utm_term=python-rucaptcha)
|
|
40
40
|
|
|
41
|
-
[](https://www.capsolver.com/?utm_source=github&utm_medium=repo&utm_campaign=scraping&utm_term=python-rucaptcha)
|
|
42
42
|
|
|
43
43
|
<hr>
|
|
44
44
|
|
|
45
45
|
[](https://badge.fury.io/py/python-rucaptcha)
|
|
46
46
|
[](https://badge.fury.io/py/python-rucaptcha)
|
|
47
47
|
[](https://pepy.tech/project/python-rucaptcha)
|
|
48
|
+
[](https://andreidrang.github.io/python-rucaptcha/)
|
|
48
49
|
|
|
49
50
|
[](https://codeclimate.com/github/AndreiDrang/python-rucaptcha/maintainability)
|
|
50
51
|
[](https://www.codacy.com/gh/AndreiDrang/python-rucaptcha/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AndreiDrang/python-rucaptcha&utm_campaign=Badge_Grade)
|
|
@@ -56,21 +57,16 @@ Requires-Dist: tenacity<10,>=8
|
|
|
56
57
|
[](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/test.yml)
|
|
57
58
|
[](https://github.com/AndreiDrang/python-rucaptcha/actions/workflows/lint.yml)
|
|
58
59
|
|
|
59
|
-
Python3 library for [RuCaptcha](https://rucaptcha.com
|
|
60
|
+
Python3 library for [RuCaptcha](https://rucaptcha.com/?from=4170435) and [2Captcha](https://2captcha.com/?from=4170435) service API.
|
|
60
61
|
|
|
61
62
|
Tested on UNIX based OS.
|
|
62
63
|
|
|
63
|
-
The library is intended for software developers and is used to work with the [RuCaptcha](https://rucaptcha.com
|
|
64
|
+
The library is intended for software developers and is used to work with the [RuCaptcha](https://rucaptcha.com/?from=4170435) and [2Captcha](https://2captcha.com/?from=4170435) service API.
|
|
64
65
|
|
|
65
66
|
Support of the service [Death By Captcha](https://deathbycaptcha.com?refid=1237267242) is integrated into this library, more information in the library documentation or in the [service docs](https://deathbycaptcha.com/api/2captcha?refid=1237267242).
|
|
66
|
-
***
|
|
67
67
|
|
|
68
68
|
Application in [RuCaptcha software](https://rucaptcha.com/software/python-rucaptcha) and [2Captcha software](https://2captcha.com/software/python-rucaptcha).
|
|
69
69
|
|
|
70
|
-
If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.
|
|
71
|
-
|
|
72
|
-
Or email python-captcha@pm.me
|
|
73
|
-
|
|
74
70
|
## How to install?
|
|
75
71
|
|
|
76
72
|
### pip
|
|
@@ -103,4 +99,10 @@ For full changelog info check - [Releases page](https://github.com/AndreiDrang/p
|
|
|
103
99
|
|
|
104
100
|
### Get API Key to work with the library
|
|
105
101
|
1. On the page - https://rucaptcha.com/enterpage
|
|
106
|
-
2. Find it: ](https://vyjava.xyz/dashboard/image/ac679557-f3cc-402f-bf95-6c45d252a2ef)
|
|
103
|
+
|
|
104
|
+
### Contacts
|
|
105
|
+
|
|
106
|
+
If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.
|
|
107
|
+
|
|
108
|
+
Or email python-captcha@pm.me
|
|
@@ -24,6 +24,7 @@ src/python_rucaptcha/image_captcha.py
|
|
|
24
24
|
src/python_rucaptcha/key_captcha.py
|
|
25
25
|
src/python_rucaptcha/lemin_captcha.py
|
|
26
26
|
src/python_rucaptcha/mt_captcha.py
|
|
27
|
+
src/python_rucaptcha/prosopo.py
|
|
27
28
|
src/python_rucaptcha/re_captcha.py
|
|
28
29
|
src/python_rucaptcha/rotate_captcha.py
|
|
29
30
|
src/python_rucaptcha/tencent.py
|
|
@@ -165,7 +165,9 @@ class TestAudioCaptcha(BaseTest):
|
|
|
165
165
|
def test_wrong_base64(self):
|
|
166
166
|
instance = AudioCaptcha(rucaptcha_key=self.RUCAPTCHA_KEY)
|
|
167
167
|
|
|
168
|
-
result = instance.captcha_handler(
|
|
168
|
+
result = instance.captcha_handler(
|
|
169
|
+
captcha_base64=self.get_random_string(length=50).encode(encoding="UTF-8")
|
|
170
|
+
)
|
|
169
171
|
|
|
170
172
|
assert isinstance(result, dict) is True
|
|
171
173
|
assert result["errorId"] in (12, 5)
|
|
@@ -134,7 +134,9 @@ class TestBoundingBoxCaptcha(BaseTest):
|
|
|
134
134
|
|
|
135
135
|
def test_wrong_base64(self):
|
|
136
136
|
instance = BoundingBoxCaptcha(rucaptcha_key=self.RUCAPTCHA_KEY)
|
|
137
|
-
result = instance.captcha_handler(
|
|
137
|
+
result = instance.captcha_handler(
|
|
138
|
+
captcha_base64=self.get_random_string(length=50).encode(encoding="UTF-8")
|
|
139
|
+
)
|
|
138
140
|
assert isinstance(result, dict) is True
|
|
139
141
|
assert result["errorId"] == 15
|
|
140
142
|
assert result["taskId"] is None
|
|
@@ -134,7 +134,9 @@ class TestCoordinatesCaptcha(BaseTest):
|
|
|
134
134
|
|
|
135
135
|
def test_wrong_base64(self):
|
|
136
136
|
instance = CoordinatesCaptcha(rucaptcha_key=self.RUCAPTCHA_KEY)
|
|
137
|
-
result = instance.captcha_handler(
|
|
137
|
+
result = instance.captcha_handler(
|
|
138
|
+
captcha_base64=self.get_random_string(length=50).encode(encoding="UTF-8")
|
|
139
|
+
)
|
|
138
140
|
assert isinstance(result, dict) is True
|
|
139
141
|
assert result["errorId"] == 15
|
|
140
142
|
assert result["taskId"] is None
|
|
@@ -134,7 +134,9 @@ class TestDrawAroundCaptcha(BaseTest):
|
|
|
134
134
|
|
|
135
135
|
def test_wrong_base64(self):
|
|
136
136
|
instance = DrawAroundCaptcha(rucaptcha_key=self.RUCAPTCHA_KEY)
|
|
137
|
-
result = instance.captcha_handler(
|
|
137
|
+
result = instance.captcha_handler(
|
|
138
|
+
captcha_base64=self.get_random_string(length=50).encode(encoding="UTF-8")
|
|
139
|
+
)
|
|
138
140
|
assert isinstance(result, dict) is True
|
|
139
141
|
assert result["errorId"] == 15
|
|
140
142
|
assert result["taskId"] is None
|
|
@@ -8,9 +8,7 @@ from python_rucaptcha.core.serializer import GetTaskResultResponseSer
|
|
|
8
8
|
|
|
9
9
|
class TestFunCaptcha(BaseTest):
|
|
10
10
|
publickey = "69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC"
|
|
11
|
-
pageurl =
|
|
12
|
-
"https://api.funcaptcha.com/tile-game-lite-mode/fc/api/nojs/?pkey=69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC&lang=en"
|
|
13
|
-
)
|
|
11
|
+
pageurl = "https://api.funcaptcha.com/tile-game-lite-mode/fc/api/nojs/?pkey=69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC&lang=en"
|
|
14
12
|
surl = "https://client-api.arkoselabs.com"
|
|
15
13
|
kwargs_params = {
|
|
16
14
|
"funcaptchaApiJSSubdomain": "sample-api.arkoselabs.com",
|
|
@@ -15,7 +15,9 @@ class TestGeeTestBase(BaseTest):
|
|
|
15
15
|
|
|
16
16
|
@property
|
|
17
17
|
def challenge(self):
|
|
18
|
-
return requests.get("https://www.geetest.com/demo/gt/register-enFullpage-official").json()[
|
|
18
|
+
return requests.get("https://www.geetest.com/demo/gt/register-enFullpage-official").json()[
|
|
19
|
+
"challenge"
|
|
20
|
+
]
|
|
19
21
|
|
|
20
22
|
|
|
21
23
|
class TestGeeTestCore(TestGeeTestBase):
|
|
@@ -136,7 +136,9 @@ class TestGridCaptcha(BaseTest):
|
|
|
136
136
|
|
|
137
137
|
def test_wrong_base64(self):
|
|
138
138
|
instance = GridCaptcha(rucaptcha_key=self.RUCAPTCHA_KEY)
|
|
139
|
-
result = instance.captcha_handler(
|
|
139
|
+
result = instance.captcha_handler(
|
|
140
|
+
captcha_base64=self.get_random_string(length=50).encode(encoding="UTF-8")
|
|
141
|
+
)
|
|
140
142
|
assert isinstance(result, dict) is True
|
|
141
143
|
assert result["errorId"] == 15
|
|
142
144
|
assert result["taskId"] is None
|
|
@@ -165,7 +165,9 @@ class TestImageCaptcha(BaseTest):
|
|
|
165
165
|
|
|
166
166
|
def test_wrong_base64(self):
|
|
167
167
|
instance = ImageCaptcha(rucaptcha_key=self.RUCAPTCHA_KEY)
|
|
168
|
-
result = instance.captcha_handler(
|
|
168
|
+
result = instance.captcha_handler(
|
|
169
|
+
captcha_base64=self.get_random_string(length=50).encode(encoding="UTF-8")
|
|
170
|
+
)
|
|
169
171
|
assert isinstance(result, dict) is True
|
|
170
172
|
assert result["errorId"] == 15
|
|
171
173
|
assert result["taskId"] is None
|
|
@@ -22,7 +22,10 @@ class TestMTCaptcha(BaseTest):
|
|
|
22
22
|
@pytest.mark.parametrize("method", MTCaptchaEnm.list_values())
|
|
23
23
|
def test_args(self, method: str):
|
|
24
24
|
instance = MTCaptcha(
|
|
25
|
-
rucaptcha_key=self.RUCAPTCHA_KEY,
|
|
25
|
+
rucaptcha_key=self.RUCAPTCHA_KEY,
|
|
26
|
+
websiteURL=self.websiteURL,
|
|
27
|
+
websiteKey=self.websiteKey,
|
|
28
|
+
method=method,
|
|
26
29
|
)
|
|
27
30
|
assert instance.create_task_payload["clientKey"] == self.RUCAPTCHA_KEY
|
|
28
31
|
assert instance.create_task_payload["task"]["type"] == method
|
|
@@ -136,7 +136,9 @@ class TestRotateCaptcha(BaseTest):
|
|
|
136
136
|
@pytest.mark.parametrize("save_format", SaveFormatsEnm.list_values())
|
|
137
137
|
@pytest.mark.parametrize("img_clearing", (True, False))
|
|
138
138
|
def test_const_data_link(self, save_format: str, img_clearing: bool):
|
|
139
|
-
instance = RotateCaptcha(
|
|
139
|
+
instance = RotateCaptcha(
|
|
140
|
+
rucaptcha_key=self.RUCAPTCHA_KEY, save_format=save_format, img_clearing=img_clearing
|
|
141
|
+
)
|
|
140
142
|
|
|
141
143
|
result = instance.captcha_handler(captcha_link=self.captcha_url)
|
|
142
144
|
|
|
@@ -199,7 +201,9 @@ class TestRotateCaptcha(BaseTest):
|
|
|
199
201
|
def test_wrong_base64(self):
|
|
200
202
|
instance = RotateCaptcha(rucaptcha_key=self.RUCAPTCHA_KEY)
|
|
201
203
|
|
|
202
|
-
result = instance.captcha_handler(
|
|
204
|
+
result = instance.captcha_handler(
|
|
205
|
+
captcha_base64=self.get_random_string(length=50).encode(encoding="UTF-8")
|
|
206
|
+
)
|
|
203
207
|
|
|
204
208
|
assert isinstance(result, dict) is True
|
|
205
209
|
assert result["errorId"] != 0
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "6.3"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha/bounding_box_captcha.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_rucaptcha-6.3 → python_rucaptcha-6.3.2}/src/python_rucaptcha.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|