Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from python_rucaptcha import (
core,
control,
prosopo,
tencent,
gee_test,
hcaptcha,
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Check our other projects here - `RedPandaDev group <https://red-panda-dev.xyz/bl
modules/mt-captcha/example.rst
modules/friendly-captcha/example.rst
modules/tencent/example.rst
modules/prosopo/example.rst
modules/atb-captcha/example.rst
modules/control/example.rst

Expand Down
12 changes: 12 additions & 0 deletions docs/modules/prosopo/example.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Prosopo
=======

To import this module:

.. code-block:: python

from python_rucaptcha.prosopo import Prosopo


.. autoclass:: python_rucaptcha.prosopo.Prosopo
:members:
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sphinx==8.1.3
sphinx==8.3.0
pallets_sphinx_themes==2.3.0
myst-parser==4.0.0
myst-parser==4.0.1
enum-tools[sphinx]==0.12.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
Expand Down
4 changes: 2 additions & 2 deletions requirements.style.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# codestyle
isort==5.*
black==24.10.0
isort==6.*
black==25.1.0
autoflake==2.*
2 changes: 1 addition & 1 deletion src/python_rucaptcha/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "6.3.1"
__version__ = "6.3.2"
1 change: 1 addition & 0 deletions src/python_rucaptcha/atb_captcha.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def __init__(

Notes:
https://rucaptcha.com/api-docs/atb-captcha

https://2captcha.com/api-docs/atb-captcha
"""
super().__init__(method=method, *args, **kwargs)
Expand Down
5 changes: 5 additions & 0 deletions src/python_rucaptcha/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,15 @@ def __init__(

Notes:
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
"""

Expand Down
5 changes: 5 additions & 0 deletions src/python_rucaptcha/core/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,8 @@ class TencentEnm(str, MyEnum):
class atbCaptchaEnm(str, MyEnum):
AtbCaptchaTask = "AtbCaptchaTask"
AtbCaptchaTaskProxyless = "AtbCaptchaTaskProxyless"


class ProsopoEnm(str, MyEnum):
ProsopoTask = "ProsopoTask"
ProsopoTaskProxyless = "ProsopoTaskProxyless "
108 changes: 108 additions & 0 deletions src/python_rucaptcha/prosopo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
from typing import Union

from .core.base import BaseCaptcha
from .core.enums import ProsopoEnm


class Prosopo(BaseCaptcha):
def __init__(
self,
websiteURL: str,
websiteKey: str,
method: Union[str, ProsopoEnm] = ProsopoEnm.ProsopoTaskProxyless,
*args,
**kwargs,
):
"""
The class is used to work with Prosopo.

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
websiteKey: The value of `siteKey` parameter found on the page.
method: Captcha type

Examples:
>>> Prosopo(rucaptcha_key="aa9011f31111181111168611f1151122",
... websiteURL="https://www.example.com/",
... websiteKey="5EPQoMZEDc5LpN7gtxMMzYPTzA6UeWqL2stk1rso9gy4Ahqt",
... method=ProsopoEnm.ProsopoTaskProxyless.value,
... ).captcha_handler()
{
"errorId":0,
"status":"ready",
"solution":{
"token": "0x00016c68747470733950547a4136",
},
"cost":"0.00299",
"ip":"1.2.3.4",
"createTime":1692863536,
"endTime":1692863556,
"solveCount":1,
"taskId":75190409731
}

>>> await Prosopo(rucaptcha_key="aa9011f31111181111168611f1151122",
... websiteURL="https://www.example.com/",
... websiteKey="5EPQoMZEDc5LpN7gtxMMzYPTzA6UeWqL2stk1rso9gy4Ahqt",
... method=ProsopoEnm.ProsopoTaskProxyless.value,
... ).aio_captcha_handler()
{
"errorId":0,
"status":"ready",
"solution":{
"token": "0x00016c68747470733950547a4136",
},
"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/prosopo-procaptcha

https://rucaptcha.com/api-docs/prosopo-procaptcha
"""
super().__init__(method=method, *args, **kwargs)

self.create_task_payload["task"].update({"websiteURL": websiteURL, "websiteKey": websiteKey})

# check user params
if method not in ProsopoEnm.list_values():
raise ValueError(f"Invalid method parameter set, available - {ProsopoEnm.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()
1 change: 1 addition & 0 deletions src/python_rucaptcha/tencent.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def __init__(

Notes:
https://rucaptcha.com/api-docs/tencent

https://2captcha.com/api-docs/tencent
"""
super().__init__(method=method, *args, **kwargs)
Expand Down
Loading