-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #241 from AndreiDrang/master
Release v6.2
- Loading branch information
Showing
18 changed files
with
431 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Tencent | ||
======= | ||
|
||
To import this module: | ||
|
||
.. code-block:: python | ||
from python_rucaptcha.tencent import Tencent | ||
.. autoclass:: python_rucaptcha.tencent.Tencent | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 = "[email protected]"}, | ||
] | ||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from python_rucaptcha.__version__ import __version__ # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "6.1.2" | ||
__version__ = "6.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.