From e29db3289e35af57fa3f00b0055518de82f2c7b4 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 18:30:45 +0300 Subject: [PATCH 01/19] Update enums.py --- src/python_rucaptcha/core/enums.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/python_rucaptcha/core/enums.py b/src/python_rucaptcha/core/enums.py index 1d999f14e..cde67f63f 100644 --- a/src/python_rucaptcha/core/enums.py +++ b/src/python_rucaptcha/core/enums.py @@ -149,3 +149,8 @@ class GridCaptchaEnm(str, MyEnum): class FriendlyCaptchaEnm(str, MyEnum): FriendlyCaptchaTaskProxyless = "FriendlyCaptchaTaskProxyless" FriendlyCaptchaTask = "FriendlyCaptchaTask" + + +class TencentEnm(str, MyEnum): + TencentTask = "TencentTask" + TencentTaskProxyless = "TencentTaskProxyless" From abf7f6b3039b68cc1552b436a076db22972e527a Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 18:30:49 +0300 Subject: [PATCH 02/19] Create tencent.py --- src/python_rucaptcha/tencent.py | 112 ++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 src/python_rucaptcha/tencent.py diff --git a/src/python_rucaptcha/tencent.py b/src/python_rucaptcha/tencent.py new file mode 100644 index 000000000..208f7f9b8 --- /dev/null +++ b/src/python_rucaptcha/tencent.py @@ -0,0 +1,112 @@ +from typing import Union + +from .core.base import BaseCaptcha +from .core.enums import TencentEnm + + +class Tencent(BaseCaptcha): + def __init__( + self, + websiteURL: str, + appId: str, + method: Union[str, TencentEnm] = TencentEnm.TencentTaskProxyless, + *args, + **kwargs, + ): + """ + The class is used to work with CapyPuzzle. + + Args: + rucaptcha_key: User API key + websiteURL: The full URL of target web page where the captcha is loaded. + We do not open the page, not a problem if it is available only for authenticated users + appId: The value of `appId` parameter in the website source code. + method: Captcha type + + Examples: + >>> Tencent(rucaptcha_key="aa9011f31111181111168611f1151122", + ... websiteURL="https://www.tencentcloud.com/account/register", + ... appId="2009899766", + ... method=TencentEnm.TencentTaskProxyless.value, + ... ).captcha_handler() + { + "errorId":0, + "status":"ready", + "solution":{ + "appid": "190014885", + "ret": 0, + "ticket": "tr034XXXXXXXXXXXXXXXXXX*", + "randstr": "@KVN" + }, + "cost":"0.00299", + "ip":"1.2.3.4", + "createTime":1692863536, + "endTime":1692863556, + "solveCount":1, + "taskId":75190409731 + } + + >>> await Tencent(rucaptcha_key="aa9011f31111181111168611f1151122", + ... websiteURL="https://www.tencentcloud.com/account/register", + ... appId="2009899766", + ... method=TencentEnm.TencentTaskProxyless.value, + ... ).aio_captcha_handler() + { + "errorId":0, + "status":"ready", + "solution":{ + "appid": "190014885", + "ret": 0, + "ticket": "tr034XXXXXXXXXXXXXXXXXX*", + "randstr": "@KVN" + }, + "cost":"0.00299", + "ip":"1.2.3.4", + "createTime":1692863536, + "endTime":1692863556, + "solveCount":1, + "taskId":75190409731 + } + + Returns: + Dict with full server response + + Notes: + https://rucaptcha.com/api-docs/tencent + https://2captcha.com/api-docs/tencent + """ + super().__init__(method=method, *args, **kwargs) + + self.create_task_payload["task"].update({"websiteURL": websiteURL, "appId": appId}) + + # check user params + if method not in TencentEnm.list_values(): + raise ValueError(f"Invalid method parameter set, available - {TencentEnm.list_values()}") + + 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() From 931a0acfde5e8f120e703d518e8d0b82294dc978 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 18:30:52 +0300 Subject: [PATCH 03/19] Update control.py --- src/python_rucaptcha/control.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/python_rucaptcha/control.py b/src/python_rucaptcha/control.py index 1e222c14c..7e635ac9c 100644 --- a/src/python_rucaptcha/control.py +++ b/src/python_rucaptcha/control.py @@ -57,6 +57,9 @@ def __init__( https://rucaptcha.com/api-docs/get-balance https://rucaptcha.com/api-docs/report-correct https://rucaptcha.com/api-docs/report-incorrect + https://2captcha.com/api-docs/get-balance + https://2captcha.com/api-docs/report-correct + https://2captcha.com/api-docs/report-incorrect """ super().__init__(method=ControlEnm.control, *args, **kwargs) From b6fe9cbfb4e0c74012085d130a1d8c348b4b0280 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:29:45 +0300 Subject: [PATCH 04/19] Create atb_captcha.py --- src/python_rucaptcha/atb_captcha.py | 110 ++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 src/python_rucaptcha/atb_captcha.py diff --git a/src/python_rucaptcha/atb_captcha.py b/src/python_rucaptcha/atb_captcha.py new file mode 100644 index 000000000..103551081 --- /dev/null +++ b/src/python_rucaptcha/atb_captcha.py @@ -0,0 +1,110 @@ +from typing import Union + +from .core.base import BaseCaptcha +from .core.enums import atbCaptchaEnm + + +class atbCaptcha(BaseCaptcha): + def __init__( + self, + websiteURL: str, + appId: str, + apiServer: str, + method: Union[str, atbCaptchaEnm] = atbCaptchaEnm.AtbCaptchaTaskProxyless, + *args, + **kwargs, + ): + """ + The class is used to work with CapyPuzzle. + + Args: + rucaptcha_key: User API key + websiteURL: The full URL of target web page where the captcha is loaded. + We do not open the page, not a problem if it is available only for authenticated users + appId: The value of `appId` parameter in the website source code. + apiServer: The value of `apiServer` parameter in the website source code. + method: Captcha type + + Examples: + >>> atbCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122", + ... websiteURL="https://www.tencentcloud.com/account/register", + ... appId="2009899766", + ... apiServer="https://cap.aisecurius.com", + ... method=atbCaptchaEnm.AtbCaptchaTaskProxyless.value, + ... ).captcha_handler() + { + "errorId":0, + "status":"ready", + "solution":{ + "token": "sl191suxzluwxxh6f:" + }, + "cost":"0.00299", + "ip":"1.2.3.4", + "createTime":1692863536, + "endTime":1692863556, + "solveCount":1, + "taskId":75190409731 + } + + >>> await atbCaptcha(rucaptcha_key="aa9011f31111181111168611f1151122", + ... websiteURL="https://www.tencentcloud.com/account/register", + ... appId="2009899766", + ... apiServer="https://cap.aisecurius.com", + ... method=atbCaptchaEnm.AtbCaptchaTaskProxyless.value, + ... ).aio_captcha_handler() + { + "errorId":0, + "status":"ready", + "solution":{ + "token": "sl191suxzluwxxh6f:" + }, + "cost":"0.00299", + "ip":"1.2.3.4", + "createTime":1692863536, + "endTime":1692863556, + "solveCount":1, + "taskId":75190409731 + } + + Returns: + Dict with full server response + + Notes: + https://rucaptcha.com/api-docs/atb-captcha + https://2captcha.com/api-docs/atb-captcha + """ + super().__init__(method=method, *args, **kwargs) + + self.create_task_payload["task"].update({"websiteURL": websiteURL, "appId": appId, "apiServer": apiServer}) + + # check user params + if method not in atbCaptchaEnm.list_values(): + raise ValueError(f"Invalid method parameter set, available - {atbCaptchaEnm.list_values()}") + + 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() From a51bb7235555c9173a576079344d9becb50277d1 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:29:47 +0300 Subject: [PATCH 05/19] Update enums.py --- src/python_rucaptcha/core/enums.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/python_rucaptcha/core/enums.py b/src/python_rucaptcha/core/enums.py index cde67f63f..cdf9a34aa 100644 --- a/src/python_rucaptcha/core/enums.py +++ b/src/python_rucaptcha/core/enums.py @@ -154,3 +154,8 @@ class FriendlyCaptchaEnm(str, MyEnum): class TencentEnm(str, MyEnum): TencentTask = "TencentTask" TencentTaskProxyless = "TencentTaskProxyless" + + +class atbCaptchaEnm(str, MyEnum): + AtbCaptchaTask = "AtbCaptchaTask" + AtbCaptchaTaskProxyless = "AtbCaptchaTaskProxyless" From 52e1187df0aa76b9391e462576948d0cba906f60 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:32:36 +0300 Subject: [PATCH 06/19] Update conf.py --- docs/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 66dc85262..bfe4c0ab0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -6,12 +6,14 @@ from python_rucaptcha import ( core, control, + tencent, gee_test, hcaptcha, turnstile, amazon_waf, mt_captcha, re_captcha, + atb_captcha, capy_puzzle, fun_captcha, key_captcha, From 682bd336954cf64cc9deeae1611e614323744b33 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:32:38 +0300 Subject: [PATCH 07/19] Create example.rst --- docs/modules/atb-captcha/example.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 docs/modules/atb-captcha/example.rst diff --git a/docs/modules/atb-captcha/example.rst b/docs/modules/atb-captcha/example.rst new file mode 100644 index 000000000..d5646750d --- /dev/null +++ b/docs/modules/atb-captcha/example.rst @@ -0,0 +1,12 @@ +atbCaptcha +========== + +To import this module: + +.. code-block:: python + + from python_rucaptcha.atb_captcha import atbCaptcha + + +.. autoclass:: python_rucaptcha.atb_captcha.atbCaptcha + :members: \ No newline at end of file From eca496cd968da3725c1a41fa7db96191a33b6a4c Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:32:49 +0300 Subject: [PATCH 08/19] Update example.rst --- docs/modules/atb-captcha/example.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/modules/atb-captcha/example.rst b/docs/modules/atb-captcha/example.rst index d5646750d..8cb952db5 100644 --- a/docs/modules/atb-captcha/example.rst +++ b/docs/modules/atb-captcha/example.rst @@ -9,4 +9,4 @@ To import this module: .. autoclass:: python_rucaptcha.atb_captcha.atbCaptcha - :members: \ No newline at end of file + :members: From 5898250c9478df9f04fdc85ccf1562cb07f3c93a Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:32:52 +0300 Subject: [PATCH 09/19] Create example.rst --- docs/modules/tencent/example.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 docs/modules/tencent/example.rst diff --git a/docs/modules/tencent/example.rst b/docs/modules/tencent/example.rst new file mode 100644 index 000000000..415b87178 --- /dev/null +++ b/docs/modules/tencent/example.rst @@ -0,0 +1,12 @@ +Tencent +======= + +To import this module: + +.. code-block:: python + + from python_rucaptcha.tencent import Tencent + + +.. autoclass:: python_rucaptcha.tencent.Tencent + :members: From 1400b838eef74c7abde6237ed012dacc4df664b5 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:32:55 +0300 Subject: [PATCH 10/19] Update setup.py --- src/setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/setup.py b/src/setup.py index 8f5cfe525..b9664a46e 100644 --- a/src/setup.py +++ b/src/setup.py @@ -108,6 +108,8 @@ def run(self): captcha security tiktok + tencent + atb_captcha python-library python-rucaptcha rucaptcha-client From 85d04ec4697163b0931850409c14ceb55c8ece0f Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:33:27 +0300 Subject: [PATCH 11/19] Update info.rst --- docs/modules/enum/info.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/modules/enum/info.rst b/docs/modules/enum/info.rst index 5579ff9f1..9e3c6c506 100644 --- a/docs/modules/enum/info.rst +++ b/docs/modules/enum/info.rst @@ -79,3 +79,9 @@ To import this module: .. autoenum:: python_rucaptcha.core.enums.FriendlyCaptchaEnm :members: + +.. autoenum:: python_rucaptcha.core.enums.TencentEnm + :members: + +.. autoenum:: python_rucaptcha.core.enums.atbCaptchaEnm + :members: From f3909fd1bd3a3a603be50af0b77673950c30c904 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:41:12 +0300 Subject: [PATCH 12/19] Create test_tencent.py --- tests/test_tencent.py | 71 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 tests/test_tencent.py diff --git a/tests/test_tencent.py b/tests/test_tencent.py new file mode 100644 index 000000000..64e2243be --- /dev/null +++ b/tests/test_tencent.py @@ -0,0 +1,71 @@ +import pytest + +from tests.conftest import BaseTest +from python_rucaptcha.tencent import Tencent +from python_rucaptcha.core.enums import TencentEnm + + +class TestTencent(BaseTest): + websiteURL = "https://www.tencentcloud.com/account/register" + appId = "2009899766" + + kwargs_params = { + "proxyLogin": "user23", + "proxyPassword": "p4$$w0rd", + "proxyType": "socks5", + "proxyAddress": BaseTest.proxyAddress, + "proxyPort": BaseTest.proxyPort, + } + + def test_methods_exists(self): + assert "captcha_handler" in Tencent.__dict__.keys() + assert "aio_captcha_handler" in Tencent.__dict__.keys() + + @pytest.mark.parametrize("method", TencentEnm.list_values()) + def test_args(self, method: str): + instance = Tencent( + rucaptcha_key=self.RUCAPTCHA_KEY, + websiteURL=self.websiteURL, + appId=self.appId, + method=method, + ) + assert instance.create_task_payload["clientKey"] == self.RUCAPTCHA_KEY + assert instance.create_task_payload["task"]["type"] == method + assert instance.create_task_payload["task"]["websiteURL"] == self.websiteURL + assert instance.create_task_payload["task"]["appId"] == self.appId + + @pytest.mark.parametrize("method", TencentEnm.list_values()) + def test_kwargs(self, method: str): + instance = Tencent( + rucaptcha_key=self.RUCAPTCHA_KEY, + websiteURL=self.websiteURL, + appId=self.appId, + method=method, + **self.kwargs_params, + ) + assert set(self.kwargs_params.keys()).issubset(set(instance.create_task_payload["task"].keys())) + assert set(self.kwargs_params.values()).issubset(set(instance.create_task_payload["task"].values())) + + """ + Fail tests + """ + + @pytest.mark.parametrize("method", TencentEnm.list_values()) + def test_no_websiteURL(self, method: str): + with pytest.raises(TypeError): + Tencent(rucaptcha_key=self.RUCAPTCHA_KEY, appId=self.appId, method=method) + + @pytest.mark.parametrize("method", TencentEnm.list_values()) + def test_no_appId(self, method: str): + with pytest.raises(TypeError): + Tencent(rucaptcha_key=self.RUCAPTCHA_KEY, websiteURL=self.websiteURL, method=method) + + @pytest.mark.parametrize("method", TencentEnm.list_values()) + def test_wrong_method(self, method: str): + with pytest.raises(ValueError): + Tencent( + rucaptcha_key=self.RUCAPTCHA_KEY, + websiteURL=self.websiteURL, + appId=self.appId, + method=self.get_random_string(length=5), + ) From dd023b5d534c0cba602cd314be4126ea3fb515d5 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:44:24 +0300 Subject: [PATCH 13/19] Update build.yml --- .github/workflows/build.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 591166d1c..fdc419a82 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 @@ -30,6 +30,4 @@ jobs: python-version: ${{ matrix.python-version }} - name: Local build checking - run: | - pip install twine wheel - cd src/ && python setup.py sdist bdist_wheel + run: make build From 0368917290852577357f8dfe22790212582844c5 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:44:26 +0300 Subject: [PATCH 14/19] Update Makefile --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 19d48c019..641cbe71c 100644 --- a/Makefile +++ b/Makefile @@ -23,13 +23,17 @@ lint: black src/ --check && \ isort src/ --check-only +build: + pip3 install --upgrade build setuptools + python3 -m build + upload: - pip3 install twine wheel - cd src/ && python setup.py upload + pip3 install twine wheel setuptools build + twine upload dist/* tests: install coverage run --rcfile=.coveragerc -m pytest --verbose --showlocals --pastebin=all \ - tests/ --disable-warnings && \ + tests/test_tencent.py --disable-warnings && \ coverage report --precision=3 --sort=cover --skip-empty --show-missing && \ coverage html --precision=3 --skip-empty -d coverage/html/ && \ coverage xml -o coverage/coverage.xml From dfd412acfa102c629fe070d42546d6fcfdf3f13a Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:51:57 +0300 Subject: [PATCH 15/19] Moved to pyproject.toml from setup.py --- pyproject.toml | 79 +++++++++++++++++ src/python_rucaptcha/__init__.py | 1 + src/requirements.txt | 4 - src/setup.py | 145 ------------------------------- 4 files changed, 80 insertions(+), 149 deletions(-) delete mode 100644 src/requirements.txt delete mode 100644 src/setup.py diff --git a/pyproject.toml b/pyproject.toml index 41eab8157..afde1efab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,3 +28,82 @@ testpaths = [ "tests", ] addopts = "-vv --tb=short --durations=10" + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "python-rucaptcha" +dynamic = ["version"] +authors = [ + {name = "AndreiDrang", email = "python-captcha@pm.me"}, +] +description = "Python 3.9+ RuCaptcha library with AIO module." +readme = "README.md" +requires-python = ">=3.9" +keywords = [ "captcha", + "rucaptcha", + "2captcha", + "deathbycaptcha", + "recaptcha", + "geetest", + "hcaptcha", + "capypuzzle", + "tiktok", + "rotatecaptcha", + "funcaptcha", + "keycaptcha", + "python3", + "recaptcha", + "captcha", + "security", + "tiktok", + "tencent", + "atb_captcha", + "python-library", + "python-rucaptcha", + "rucaptcha-client", + "yandex", + "turnstile", + "amazon", + "amazon_waf", + "friendly-captcha" + ] +license = {text = "MIT License"} +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", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Framework :: AsyncIO", + "Operating System :: Unix", + "Operating System :: Microsoft :: Windows", + "Operating System :: MacOS", +] +dependencies = [ + "requests>=2.21.0", + "aiohttp>=3.9.2", + "msgspec==0.18.*", + "tenacity==8.*" +] + +[tool.setuptools.packages.find] +where = ["src"] +include = ["python_rucaptcha*"] + +[tool.setuptools.dynamic] +version = {attr = "python_rucaptcha.__version__"} + +[project.urls] +Homepage = "https://andreidrang.github.io/python-rucaptcha/" +Documentation = "https://andreidrang.github.io/python-rucaptcha/" +Repository = "https://github.com/AndreiDrang/python-rucaptcha" +Issues = "https://github.com/AndreiDrang/python-rucaptcha/issues" +Changelog = "https://github.com/AndreiDrang/python-rucaptcha/releases" diff --git a/src/python_rucaptcha/__init__.py b/src/python_rucaptcha/__init__.py index e69de29bb..870cabd0f 100644 --- a/src/python_rucaptcha/__init__.py +++ b/src/python_rucaptcha/__init__.py @@ -0,0 +1 @@ +from python_rucaptcha.__version__ import __version__ # noqa diff --git a/src/requirements.txt b/src/requirements.txt deleted file mode 100644 index c9b176894..000000000 --- a/src/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -requests>=2.28.0 -aiohttp>=3.9.0 -msgspec==0.18.* -tenacity==8.2.* diff --git a/src/setup.py b/src/setup.py deleted file mode 100644 index b9664a46e..000000000 --- a/src/setup.py +++ /dev/null @@ -1,145 +0,0 @@ -import io -import os -import sys -import shutil -import logging - -from setuptools import Command, setup -from pkg_resources import parse_requirements - -from python_rucaptcha.__version__ import __version__ - -# Package meta-data. -NAME = "python-rucaptcha" -DESCRIPTION = "Python 3.9+ RuCaptcha library with AIO module." -URL = "https://andreidrang.github.io/python-rucaptcha/" -EMAIL = "python-captcha@pm.me" -AUTHOR = "AndreiDrang, redV0ID" -REQUIRES_PYTHON = ">=3.9.0" -VERSION = __version__ -with open("requirements.txt", "rt") as requirements_txt: - REQUIRED = [str(requirement) for requirement in parse_requirements(requirements_txt)] - - -here = os.path.abspath(os.path.dirname(__file__)) - -# Import the README and use it as the long-description. -# Note: this will only work if 'README.md' is present in your MANIFEST.in file! -try: - with io.open(os.path.join(here, "../README.md"), encoding="utf-8") as f: - long_description = "\n" + f.read() -except FileNotFoundError: - long_description = DESCRIPTION - - -class UploadCommand(Command): - """Support setup.py upload.""" - - description = "Build and publish the package." - user_options = [] - - @staticmethod - def status(s): - """Prints things in bold.""" - print("\033[1m{0}\033[0m".format(s)) - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - logging.info("Building Source and Wheel distribution . . .") - os.system("python setup.py sdist bdist_wheel") - - logging.info("Uploading the package to PyPI via Twin . . .") - os.system("twine upload dist/* --verbose") - - logging.info("🤖 Uploaded . . .") - - logging.info("Clean dist . . .") - shutil.rmtree("dist/", ignore_errors=True) - - logging.info("Clean build . . .") - shutil.rmtree("build/", ignore_errors=True) - - logging.info("Clean python_rucaptcha.egg-info . . .") - shutil.rmtree("python_rucaptcha.egg-info/", ignore_errors=True) - sys.exit() - - -setup( - name=NAME, - version=VERSION, - author=AUTHOR, - packages=["python_rucaptcha", "python_rucaptcha.core"], - install_requires=REQUIRED, - description=DESCRIPTION, - long_description=long_description, - long_description_content_type="text/markdown", - author_email=EMAIL, - project_urls={ - "Documentation": URL, - "Source": "https://github.com/AndreiDrang/python-rucaptcha", - "Changelog": "https://github.com/AndreiDrang/python-rucaptcha/releases", - "Issue tracker": "https://github.com/AndreiDrang/python-rucaptcha/issues", - }, - package_dir={"python-rucaptcha": "python_rucaptcha"}, - include_package_data=True, - py_modules=["python_rucaptcha"], - url=URL, - license="MIT", - keywords=""" - captcha - rucaptcha - 2captcha - deathbycaptcha - recaptcha - geetest - hcaptcha - capypuzzle - tiktok - rotatecaptcha - funcaptcha - keycaptcha - python3 - recaptcha - captcha - security - tiktok - tencent - atb_captcha - python-library - python-rucaptcha - rucaptcha-client - yandex - turnstile - amazon - amazon_waf - friendly-captcha - """, - python_requires=REQUIRES_PYTHON, - zip_safe=False, - classifiers=[ - # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers - "License :: OSI Approved :: MIT License", - "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Development Status :: 5 - Production/Stable", - "Framework :: AsyncIO", - "Operating System :: Unix", - "Operating System :: Microsoft :: Windows", - "Operating System :: MacOS", - ], - # Build - `python setup.py bdist_wheel` - # Upload package: `python3 setup.py upload` - cmdclass={"upload": UploadCommand}, -) -print("🤖 Success install ...") From 7a4bb134ba494b3277adce866f847b5a1d65771c Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:52:05 +0300 Subject: [PATCH 16/19] Release v6.2 --- src/python_rucaptcha/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_rucaptcha/__version__.py b/src/python_rucaptcha/__version__.py index 0237e6dc3..063175c61 100644 --- a/src/python_rucaptcha/__version__.py +++ b/src/python_rucaptcha/__version__.py @@ -1 +1 @@ -__version__ = "6.1.2" +__version__ = "6.2" From 863c265111f76ed34ac83edd5405b3b795084ff7 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:53:21 +0300 Subject: [PATCH 17/19] Update install.yml --- .github/workflows/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 74a3f8d69..9d269f133 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 From a51a3bca4442bd617f4f18b47687c23e49f6fe19 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:53:46 +0300 Subject: [PATCH 18/19] Update lint.yml --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 537ae4db5..20a77e693 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.11"] + python-version: ["3.12"] steps: - uses: actions/checkout@v4 From 8c69345dbf524409ed30c7e86f6b825f8c10cfcd Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 29 Apr 2024 19:54:47 +0300 Subject: [PATCH 19/19] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 641cbe71c..fe4d4102b 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ install: - cd src/ && pip3 install -e . + pip3 install -e . remove: pip3 uninstall python_rucaptcha -y