Skip to content

Commit 31b2cd7

Browse files
authored
Merge pull request #336 from AndreiDrang/master
Release v6.4.0
2 parents 21b7772 + 1c77f49 commit 31b2cd7

10 files changed

Lines changed: 148 additions & 8 deletions

File tree

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Andrei
3+
Copyright (c) 2025 Andrei
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
mt_captcha,
1616
re_captcha,
1717
atb_captcha,
18+
captcha_fox,
1819
capy_puzzle,
1920
fun_captcha,
2021
key_captcha,

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Check our other projects here - `RedPandaDev group <https://red-panda-dev.xyz/bl
5252
modules/tencent/example.rst
5353
modules/prosopo/example.rst
5454
modules/atb-captcha/example.rst
55+
modules/captcha-fox/example.rst
5556
modules/control/example.rst
5657

5758
.. toctree::
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CaptchaFox
2+
==========
3+
4+
To import this module:
5+
6+
.. code-block:: python
7+
8+
from python_rucaptcha.captcha_fox import CaptchaFox
9+
10+
11+
.. autoclass:: python_rucaptcha.captcha_fox.CaptchaFox
12+
:members:

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sphinx==8.3.0
22
pallets_sphinx_themes==2.3.0
33
myst-parser==4.0.1
4-
enum-tools[sphinx]==0.12.0
4+
enum-tools[sphinx]==0.13.0
55
requests>=2.32.0 # not directly required, pinned by Snyk to avoid a vulnerability
66
urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability
77
zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,8 @@ keywords = [ "captcha",
6868
"amazon_waf",
6969
"friendly-captcha"
7070
]
71-
license = {text = "MIT License"}
71+
license = "MIT"
7272
classifiers = [
73-
"License :: OSI Approved :: MIT License",
74-
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
7573
"Development Status :: 5 - Production/Stable",
7674
"Programming Language :: Python",
7775
"Programming Language :: Python :: 3",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "6.3.2"
1+
__version__ = "6.4.0"
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
from .core.base import BaseCaptcha
2+
from .core.enums import CaptchaFoxEnm
3+
4+
5+
class CaptchaFox(BaseCaptcha):
6+
def __init__(
7+
self,
8+
websiteURL: str,
9+
websiteKey: str,
10+
userAgent: str,
11+
proxyType: str,
12+
proxyAddress: str,
13+
proxyPort: str,
14+
*args,
15+
**kwargs,
16+
):
17+
"""
18+
The class is used to work with CaptchaFox.
19+
20+
Args:
21+
rucaptcha_key: User API key
22+
websiteURL: Full URL of the captcha page
23+
websiteKey: The value of the `key` parameter.
24+
It can be found in the page source code or captured in network requests during page loading.
25+
userAgent: User-Agent of your browser will be used to load the captcha.
26+
Use only modern browser's User-Agents
27+
proxyType: Proxy type - `http`, `socks4`, `socks5`
28+
proxyAddress: Proxy IP address or hostname
29+
proxyPort: Proxy port
30+
method: Captcha type
31+
kwargs: Not required params for task creation request
32+
33+
Examples:
34+
>>> CaptchaFox(rucaptcha_key="aa9011f31111181111168611f1151122",
35+
... websiteURL="3ceb8624-1970-4e6b-91d5-70317b70b651",
36+
... websiteKey="sk_xtNxpk6fCdFbxh1_xJeGflSdCE9tn99G",
37+
... userAgent="Mozilla/5.0 .....",
38+
... proxyType="socks5",
39+
... proxyAddress="1.2.3.4",
40+
... proxyPort="445",
41+
... ).captcha_handler()
42+
{
43+
"errorId":0,
44+
"status":"ready",
45+
"solution":{
46+
"token":"142000f.....er"
47+
},
48+
"cost":"0.002",
49+
"ip":"1.2.3.4",
50+
"createTime":1692863536,
51+
"endTime":1692863556,
52+
"solveCount":0,
53+
"taskId": 73243152973,
54+
}
55+
56+
>>> await CaptchaFox(rucaptcha_key="aa9011f31111181111168611f1151122",
57+
... websiteURL="3ceb8624-1970-4e6b-91d5-70317b70b651",
58+
... websiteKey="sk_xtNxpk6fCdFbxh1_xJeGflSdCE9tn99G",
59+
... userAgent="Mozilla/5.0 .....",
60+
... proxyType="socks5",
61+
... proxyAddress="1.2.3.4",
62+
... proxyPort="445",
63+
... ).aio_captcha_handler()
64+
{
65+
"errorId":0,
66+
"status":"ready",
67+
"solution":{
68+
"token":"142000f.....er"
69+
},
70+
"cost":"0.002",
71+
"ip":"1.2.3.4",
72+
"createTime":1692863536,
73+
"endTime":1692863556,
74+
"solveCount":0,
75+
"taskId": 73243152973,
76+
}
77+
78+
Returns:
79+
Dict with full server response
80+
81+
Notes:
82+
https://2captcha.com/api-docs/captchafox
83+
84+
https://rucaptcha.com/api-docs/captchafox
85+
"""
86+
super().__init__(method=CaptchaFoxEnm.CaptchaFoxTask, *args, **kwargs)
87+
88+
self.create_task_payload["task"].update(
89+
{
90+
"websiteURL": websiteURL,
91+
"websiteKey": websiteKey,
92+
"userAgent": userAgent,
93+
"proxyType": proxyType,
94+
"proxyAddress": proxyAddress,
95+
"proxyPort": proxyPort,
96+
}
97+
)
98+
99+
def captcha_handler(self, **kwargs) -> dict:
100+
"""
101+
Sync solving method
102+
103+
Args:
104+
kwargs: additional params for `requests` library
105+
106+
Returns:
107+
Dict with full server response
108+
109+
Notes:
110+
Check class docstirng for more info
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()

src/python_rucaptcha/core/enums.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,7 @@ class atbCaptchaEnm(str, MyEnum):
164164
class ProsopoEnm(str, MyEnum):
165165
ProsopoTask = "ProsopoTask"
166166
ProsopoTaskProxyless = "ProsopoTaskProxyless "
167+
168+
169+
class CaptchaFoxEnm(str, MyEnum):
170+
CaptchaFoxTask = "CaptchaFoxTask"

src/python_rucaptcha/datadome_captcha.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(
3434
>>> DataDomeCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
3535
... websiteURL="3ceb8624-1970-4e6b-91d5-70317b70b651",
3636
... captchaUrl="https://rucaptcha.com/demo/hcaptcha",
37-
... userAgent="https://rucaptcha.com/demo/hcaptcha",
37+
... userAgent="Mozilla/5.0 .....",
3838
... proxyType="socks5",
3939
... proxyAddress="1.2.3.4",
4040
... proxyPort="445",
@@ -56,7 +56,7 @@ def __init__(
5656
>>> await DataDomeCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122",
5757
... websiteURL="3ceb8624-1970-4e6b-91d5-70317b70b651",
5858
... captchaUrl="https://rucaptcha.com/demo/hcaptcha",
59-
... userAgent="https://rucaptcha.com/demo/hcaptcha",
59+
... userAgent="Mozilla/5.0 .....",
6060
... proxyType="socks5",
6161
... proxyAddress="1.2.3.4",
6262
... proxyPort="445",

0 commit comments

Comments
 (0)