From 47fd4dcf20b3d2b77d9b8aef63d1f233b3889196 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Thu, 17 Apr 2025 18:45:01 +0300 Subject: [PATCH 1/4] Update enum-tools from 0.12.0 to 0.13.0 --- docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 516c08c2..41e3c962 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,7 +1,7 @@ sphinx==8.3.0 pallets_sphinx_themes==2.3.0 myst-parser==4.0.1 -enum-tools[sphinx]==0.12.0 +enum-tools[sphinx]==0.13.0 requests>=2.32.0 # not directly required, pinned by Snyk to avoid a vulnerability urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability From 6618bf98182fe175c9e2d22db05f97f10064f1d9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Apr 2025 17:24:56 +0000 Subject: [PATCH 2/4] Bump enum-tools[sphinx] from 0.12.0 to 0.13.0 Bumps [enum-tools[sphinx]](https://github.com/domdfcoding/enum_tools) from 0.12.0 to 0.13.0. - [Release notes](https://github.com/domdfcoding/enum_tools/releases) - [Commits](https://github.com/domdfcoding/enum_tools/compare/v0.12.0...v0.13.0) --- updated-dependencies: - dependency-name: enum-tools[sphinx] dependency-version: 0.13.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 516c08c2..41e3c962 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,7 +1,7 @@ sphinx==8.3.0 pallets_sphinx_themes==2.3.0 myst-parser==4.0.1 -enum-tools[sphinx]==0.12.0 +enum-tools[sphinx]==0.13.0 requests>=2.32.0 # not directly required, pinned by Snyk to avoid a vulnerability urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability From c9e028e441aee55abac52e893d4d47da09c56181 Mon Sep 17 00:00:00 2001 From: Andrei Date: Sun, 25 May 2025 21:00:02 +0300 Subject: [PATCH 3/4] release 6.4.0 --- LICENSE | 2 +- pyproject.toml | 4 +- src/python_rucaptcha/__version__.py | 2 +- src/python_rucaptcha/captcha_fox.py | 124 +++++++++++++++++++++++ src/python_rucaptcha/core/enums.py | 4 + src/python_rucaptcha/datadome_captcha.py | 4 +- 6 files changed, 133 insertions(+), 7 deletions(-) create mode 100644 src/python_rucaptcha/captcha_fox.py diff --git a/LICENSE b/LICENSE index 3ce826a2..d3be45e3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Andrei +Copyright (c) 2025 Andrei Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/pyproject.toml b/pyproject.toml index 39c88696..36297891 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,10 +68,8 @@ keywords = [ "captcha", "amazon_waf", "friendly-captcha" ] -license = {text = "MIT License"} +license = "MIT" classifiers = [ - "License :: OSI Approved :: MIT License", - "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3", diff --git a/src/python_rucaptcha/__version__.py b/src/python_rucaptcha/__version__.py index 123dd5c0..f0a00b37 100644 --- a/src/python_rucaptcha/__version__.py +++ b/src/python_rucaptcha/__version__.py @@ -1 +1 @@ -__version__ = "6.3.2" +__version__ = "6.4.0" diff --git a/src/python_rucaptcha/captcha_fox.py b/src/python_rucaptcha/captcha_fox.py new file mode 100644 index 00000000..ec4a231a --- /dev/null +++ b/src/python_rucaptcha/captcha_fox.py @@ -0,0 +1,124 @@ +from .core.base import BaseCaptcha +from .core.enums import CaptchaFoxEnm + + +class CaptchaFox(BaseCaptcha): + def __init__( + self, + websiteURL: str, + websiteKey: str, + userAgent: str, + proxyType: str, + proxyAddress: str, + proxyPort: str, + *args, + **kwargs, + ): + """ + The class is used to work with CaptchaFox. + + Args: + rucaptcha_key: User API key + websiteURL: Full URL of the captcha page + websiteKey: The value of the `key` parameter. + It can be found in the page source code or captured in network requests during page loading. + userAgent: User-Agent of your browser will be used to load the captcha. + Use only modern browser's User-Agents + proxyType: Proxy type - `http`, `socks4`, `socks5` + proxyAddress: Proxy IP address or hostname + proxyPort: Proxy port + method: Captcha type + kwargs: Not required params for task creation request + + Examples: + >>> CaptchaFox(rucaptcha_key="aa9011f31111181111168611f1151122", + ... websiteURL="3ceb8624-1970-4e6b-91d5-70317b70b651", + ... websiteKey="sk_xtNxpk6fCdFbxh1_xJeGflSdCE9tn99G", + ... userAgent="Mozilla/5.0 .....", + ... proxyType="socks5", + ... proxyAddress="1.2.3.4", + ... proxyPort="445", + ... ).captcha_handler() + { + "errorId":0, + "status":"ready", + "solution":{ + "token":"142000f.....er" + }, + "cost":"0.002", + "ip":"1.2.3.4", + "createTime":1692863536, + "endTime":1692863556, + "solveCount":0, + "taskId": 73243152973, + } + + >>> await CaptchaFox(rucaptcha_key="aa9011f31111181111168611f1151122", + ... websiteURL="3ceb8624-1970-4e6b-91d5-70317b70b651", + ... websiteKey="sk_xtNxpk6fCdFbxh1_xJeGflSdCE9tn99G", + ... userAgent="Mozilla/5.0 .....", + ... proxyType="socks5", + ... proxyAddress="1.2.3.4", + ... proxyPort="445", + ... ).aio_captcha_handler() + { + "errorId":0, + "status":"ready", + "solution":{ + "token":"142000f.....er" + }, + "cost":"0.002", + "ip":"1.2.3.4", + "createTime":1692863536, + "endTime":1692863556, + "solveCount":0, + "taskId": 73243152973, + } + + Returns: + Dict with full server response + + Notes: + https://2captcha.com/api-docs/captchafox + + https://rucaptcha.com/api-docs/captchafox + """ + super().__init__(method=CaptchaFoxEnm.CaptchaFoxTask, *args, **kwargs) + + self.create_task_payload["task"].update( + { + "websiteURL": websiteURL, + "websiteKey": websiteKey, + "userAgent": userAgent, + "proxyType": proxyType, + "proxyAddress": proxyAddress, + "proxyPort": proxyPort, + } + ) + + def captcha_handler(self, **kwargs) -> dict: + """ + Sync solving method + + Args: + kwargs: additional params for `requests` library + + Returns: + Dict with full server response + + Notes: + Check class docstirng for more info + """ + return self._processing_response(**kwargs) + + async def aio_captcha_handler(self) -> dict: + """ + Async solving method + + Returns: + Dict with full server response + + Notes: + Check class docstirng for more info + """ + return await self._aio_processing_response() diff --git a/src/python_rucaptcha/core/enums.py b/src/python_rucaptcha/core/enums.py index 9d1aa9a1..ab9a0feb 100644 --- a/src/python_rucaptcha/core/enums.py +++ b/src/python_rucaptcha/core/enums.py @@ -164,3 +164,7 @@ class atbCaptchaEnm(str, MyEnum): class ProsopoEnm(str, MyEnum): ProsopoTask = "ProsopoTask" ProsopoTaskProxyless = "ProsopoTaskProxyless " + + +class CaptchaFoxEnm(str, MyEnum): + CaptchaFoxTask = "CaptchaFoxTask" diff --git a/src/python_rucaptcha/datadome_captcha.py b/src/python_rucaptcha/datadome_captcha.py index 095ee864..90591d8b 100644 --- a/src/python_rucaptcha/datadome_captcha.py +++ b/src/python_rucaptcha/datadome_captcha.py @@ -34,7 +34,7 @@ def __init__( >>> DataDomeCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122", ... websiteURL="3ceb8624-1970-4e6b-91d5-70317b70b651", ... captchaUrl="https://rucaptcha.com/demo/hcaptcha", - ... userAgent="https://rucaptcha.com/demo/hcaptcha", + ... userAgent="Mozilla/5.0 .....", ... proxyType="socks5", ... proxyAddress="1.2.3.4", ... proxyPort="445", @@ -56,7 +56,7 @@ def __init__( >>> await DataDomeCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122", ... websiteURL="3ceb8624-1970-4e6b-91d5-70317b70b651", ... captchaUrl="https://rucaptcha.com/demo/hcaptcha", - ... userAgent="https://rucaptcha.com/demo/hcaptcha", + ... userAgent="Mozilla/5.0 .....", ... proxyType="socks5", ... proxyAddress="1.2.3.4", ... proxyPort="445", From 1c77f494aa55a477470eae0a643f92435d2cb5c8 Mon Sep 17 00:00:00 2001 From: Andrei Date: Sun, 25 May 2025 21:04:36 +0300 Subject: [PATCH 4/4] added docs --- docs/conf.py | 1 + docs/index.rst | 1 + docs/modules/captcha-fox/example.rst | 12 ++++++++++++ 3 files changed, 14 insertions(+) create mode 100644 docs/modules/captcha-fox/example.rst diff --git a/docs/conf.py b/docs/conf.py index 236d3466..78eaeb31 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,6 +15,7 @@ mt_captcha, re_captcha, atb_captcha, + captcha_fox, capy_puzzle, fun_captcha, key_captcha, diff --git a/docs/index.rst b/docs/index.rst index f53e67f4..9591d647 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -52,6 +52,7 @@ Check our other projects here - `RedPandaDev group