Skip to content

Commit

Permalink
Merge pull request #133 from AndreiDrang/main
Browse files Browse the repository at this point in the history
upd readme
  • Loading branch information
AndreiDrang authored Jan 5, 2025
2 parents e71f6bc + cc9f30d commit c7fba25
Show file tree
Hide file tree
Showing 19 changed files with 701 additions and 430 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
[![PyPI version](https://badge.fury.io/py/python3-capsolver.svg)](https://badge.fury.io/py/python3-capsolver)
[![Python versions](https://img.shields.io/pypi/pyversions/python3-capsolver.svg?logo=python&logoColor=FBE072)](https://badge.fury.io/py/python3-capsolver)
[![Downloads](https://static.pepy.tech/badge/python3-capsolver/month)](https://pepy.tech/project/python3-capsolver)
[![Static Badge](https://img.shields.io/badge/docs-Sphinx-green?label=Documentation&labelColor=gray)](https://andreidrang.github.io/python3-capsolver/)

[![Maintainability](https://api.codeclimate.com/v1/badges/3c30167b5fb37a0775ea/maintainability)](https://codeclimate.com/github/AndreiDrang/python3-capsolver/maintainability)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/323d4eda0fe1477bbea8fe8902b9e97e)](https://www.codacy.com/gh/AndreiDrang/python3-capsolver/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AndreiDrang/python3-capsolver&utm_campaign=Badge_Grade)
[![codecov](https://codecov.io/gh/AndreiDrang/python3-capsolver/branch/main/graph/badge.svg?token=2L4VVIF4G8)](https://codecov.io/gh/AndreiDrang/python3-capsolver)

Expand All @@ -25,12 +25,6 @@ Tested on UNIX based OS.

The library is intended for software developers and is used to work with the [Capsolver](https://dashboard.capsolver.com/passport/register?inviteCode=kQTn-tG07Jb1) service API.

***

If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.

Or email [email protected]

## How to install?

We recommend using the latest version of Python. `python3-capsolver` supports Python 3.7+.
Expand Down Expand Up @@ -59,3 +53,9 @@ Check [releases page](https://github.com/AndreiDrang/python3-capsolver/releases)
### How to get API Key to work with the library
1. On the page - https://dashboard.capsolver.com/overview/user-center
2. Find it: [![img.png](https://s.vyjava.xyz/files/2024/12-December/17/ae8d4fbf/img.png)](https://vyjava.xyz/dashboard/image/ae8d4fbf-7451-441d-8984-79b1a7adbe27)

### Contacts

If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.

Or email [email protected]
10 changes: 7 additions & 3 deletions docs/modules/main/info.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
[![PyPI version](https://badge.fury.io/py/python3-capsolver.svg)](https://badge.fury.io/py/python3-capsolver)
[![Python versions](https://img.shields.io/pypi/pyversions/python3-capsolver.svg?logo=python&logoColor=FBE072)](https://badge.fury.io/py/python3-capsolver)
[![Downloads](https://pepy.tech/badge/python3-capsolver/month)](https://pepy.tech/project/python3-capsolver)
[![Static Badge](https://img.shields.io/badge/docs-Sphinx-green?label=Documentation&labelColor=gray)](https://andreidrang.github.io/python3-capsolver/)

[![Maintainability](https://api.codeclimate.com/v1/badges/3c30167b5fb37a0775ea/maintainability)](https://codeclimate.com/github/AndreiDrang/python3-capsolver/maintainability)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/323d4eda0fe1477bbea8fe8902b9e97e)](https://www.codacy.com/gh/AndreiDrang/python3-capsolver/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AndreiDrang/python3-capsolver&utm_campaign=Badge_Grade)
[![codecov](https://codecov.io/gh/AndreiDrang/python3-capsolver/branch/main/graph/badge.svg?token=2L4VVIF4G8)](https://codecov.io/gh/AndreiDrang/python3-capsolver)

Expand All @@ -27,8 +27,6 @@ Tested on UNIX based OS.

The library is intended for software developers and is used to work with the [Capsolver](https://dashboard.capsolver.com/passport/register?inviteCode=kQTn-tG07Jb1) service API.

***

You can check our other projects here - [RedPandaDev group](https://red-panda-dev.xyz/blog/).

***
Expand Down Expand Up @@ -59,3 +57,9 @@ python setup.py install
### Changelog

Check [releases page](https://github.com/AndreiDrang/python3-capsolver/releases).

### Contacts

If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.

Or email [email protected]
8 changes: 7 additions & 1 deletion docs/modules/other-libs/info.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@
1. [RuCaptcha / 2Captcha](https://github.com/AndreiDrang/python-rucaptcha)
2. [AntiCaptcha](https://github.com/AndreiDrang/python3-anticaptcha)
3. [Capsolver](https://github.com/AndreiDrang/python3-capsolver)
4. [RedPandaDev group](https://red-panda-dev.xyz/)

## Rust
1. [Rust-AntiCaptcha crate](https://crates.io/crates/rust-anticaptcha)

Our other projects:
- [RedPandaDev group](https://red-panda-dev.xyz/blog/)

2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ sphinx==8.1.3
pallets_sphinx_themes==2.3.0
myst-parser==4.0.0
autodoc_pydantic==2.2.0
pydantic==2.10.3
pydantic==2.10.4
pydantic-settings==2.7.0
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ classifiers = [
dependencies = [
"requests>=2.21.0",
"aiohttp>=3.9.2",
"pydantic>=2.5.0",
"msgspec>=0.18,<0.20",
"tenacity>=8,<10"
]

Expand Down
13 changes: 4 additions & 9 deletions src/python3_capsolver/akamai.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
from typing import Union

from python3_capsolver.core.base import BaseCaptcha
from python3_capsolver.core.enum import AntiAkamaiTaskEnm, EndpointPostfixEnm
from python3_capsolver.core.serializer import (
PostRequestSer,
CaptchaResponseSer,
AntiAkamaiBMPTaskSer,
AntiAkamaiWebTaskSer,
)
from .core.base import CaptchaParams
from .core.enum import AntiAkamaiTaskEnm, EndpointPostfixEnm
from .core.serializer import PostRequestSer, CaptchaResponseSer, AntiAkamaiBMPTaskSer, AntiAkamaiWebTaskSer


class Akamai(BaseCaptcha):
class Akamai(CaptchaParams):
"""
The class is used to work with Capsolver AntiAkamai methods.
Expand Down
179 changes: 82 additions & 97 deletions src/python3_capsolver/aws_waf.py
Original file line number Diff line number Diff line change
@@ -1,111 +1,96 @@
from typing import Union
from typing import Union, Optional

from python3_capsolver.core.base import BaseCaptcha
from python3_capsolver.core.enum import AntiAwsWafTaskTypeEnm
from python3_capsolver.core.serializer import CaptchaResponseSer, WebsiteDataOptionsSer
from .core.base import CaptchaParams
from .core.enum import AntiAwsWafTaskTypeEnm

__all__ = ("AwsWaf",)

class AwsWaf(BaseCaptcha):
"""
The class is used to work with Capsolver AwsWaf methods.

Args:
api_key: Capsolver API key
captcha_type: Captcha type name, like ``AntiAwsWafTask`` and etc.
websiteURL: Address of a webpage with AwsWaf
Examples:
>>> AwsWaf(api_key="CAI-BA9XXXXXXXXXXXXX2702E010",
... captcha_type='AntiAwsWafTaskProxyLess',
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
... ).captcha_handler()
CaptchaResponseSer(errorId=0,
errorCode=None,
errorDescription=None,
taskId='73bdcd28-6c77-4414-8....',
status=<ResponseStatusEnm.Ready: 'ready'>,
solution={'cookie': '44795sds...'}
)
>>> AwsWaf(api_key="CAI-BA9XXXXXXXXXXXXX2702E010",
... captcha_type=AntiAwsWafTaskTypeEnm.AntiAwsWafTaskProxyLess,
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
... ).captcha_handler()
CaptchaResponseSer(errorId=0,
errorCode=None,
errorDescription=None,
taskId='73bdcd28-6c77-4414-8....',
status=<ResponseStatusEnm.Ready: 'ready'>,
solution={'cookie': '44795sds...'}
)
>>> AwsWaf(api_key="CAI-BA9XXXXXXXXXXXXX2702E010",
... captcha_type=AntiAwsWafTaskTypeEnm.AntiAwsWafTask,
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
... proxy="socks5:192.191.100.10:4780:user:pwd",
... awsKey="some key"
... ).captcha_handler()
CaptchaResponseSer(errorId=0,
errorCode=None,
errorDescription=None,
taskId="87f149f4-1c....",
status=<ResponseStatusEnm.Ready: 'ready'>,
solution={'cookie': '44795sds...'}
)
>>> await AwsWaf(api_key="CAI-BA9650D2B9C2786B21120D512702E010",
... captcha_type=AntiAwsWafTaskTypeEnm.AntiAwsWafTaskProxyLess,
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
... ).aio_captcha_handler()
CaptchaResponseSer(errorId=0,
errorCode=None,
errorDescription=None,
taskId='73bdcd28-6c77-4414-8....',
status=<ResponseStatusEnm.Ready: 'ready'>,
solution={'cookie': '44795sds...'}
)
class AwsWaf(CaptchaParams):
def __init__(
self,
api_key: str,
captcha_type: Union[AntiAwsWafTaskTypeEnm, str],
websiteURL: str,
sleep_time: Optional[int] = 10,
**additional_params,
):
"""
The class is used to work with Capsolver AwsWaf methods.
Args:
api_key: Capsolver API key
captcha_type: Captcha type name, like ``AntiAwsWafTask`` and etc.
websiteURL: Address of a webpage with AwsWaf
additional_params: Some additional parameters that will be used in creating the task
and will be passed to the payload under ``task`` key.
Like ``proxyLogin``, ``proxyPassword`` and etc. - more info in service docs
Examples:
>>> AwsWaf(api_key="CAI-BA9XXXXXXXXXXXXX2702E010",
... captcha_type='AntiAwsWafTaskProxyLess',
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
... ).captcha_handler()
CaptchaResponseSer(errorId=0,
errorCode=None,
errorDescription=None,
taskId='73bdcd28-6c77-4414-8....',
status=<ResponseStatusEnm.Ready: 'ready'>,
solution={'cookie': '44795sds...'}
)
>>> AwsWaf(api_key="CAI-BA9XXXXXXXXXXXXX2702E010",
... captcha_type=AntiAwsWafTaskTypeEnm.AntiAwsWafTaskProxyLess,
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
... ).captcha_handler()
CaptchaResponseSer(errorId=0,
errorCode=None,
errorDescription=None,
taskId='73bdcd28-6c77-4414-8....',
status=<ResponseStatusEnm.Ready: 'ready'>,
solution={'cookie': '44795sds...'}
)
>>> AwsWaf(api_key="CAI-BA9XXXXXXXXXXXXX2702E010",
... captcha_type=AntiAwsWafTaskTypeEnm.AntiAwsWafTask,
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
... proxy="socks5:192.191.100.10:4780:user:pwd",
... awsKey="some key"
... ).captcha_handler()
CaptchaResponseSer(errorId=0,
errorCode=None,
errorDescription=None,
taskId="87f149f4-1c....",
status=<ResponseStatusEnm.Ready: 'ready'>,
solution={'cookie': '44795sds...'}
)
>>> await AwsWaf(api_key="CAI-BA9650D2B9C2786B21120D512702E010",
... captcha_type=AntiAwsWafTaskTypeEnm.AntiAwsWafTaskProxyLess,
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
... ).aio_captcha_handler()
CaptchaResponseSer(errorId=0,
errorCode=None,
errorDescription=None,
taskId='73bdcd28-6c77-4414-8....',
status=<ResponseStatusEnm.Ready: 'ready'>,
solution={'cookie': '44795sds...'}
)
Returns:
CaptchaResponseSer model with full server response
Returns:
CaptchaResponseSer model with full server response
Notes:
https://docs.capsolver.com/guide/captcha/awsWaf.html
"""
Notes:
https://docs.capsolver.com/guide/captcha/awsWaf.html
"""

def __init__(self, captcha_type: Union[AntiAwsWafTaskTypeEnm, str], websiteURL: str, *args, **kwargs):
super().__init__(*args, **kwargs)
super().__init__(api_key=api_key, sleep_time=sleep_time)

if captcha_type in AntiAwsWafTaskTypeEnm.list():
self.task_params = WebsiteDataOptionsSer(**locals()).dict()
self.task_params.update(dict(type=captcha_type, websiteURL=websiteURL, **additional_params))
else:
raise ValueError(
f"""Invalid `captcha_type` parameter set for `{self.__class__.__name__}`,
available - {AntiAwsWafTaskTypeEnm.list_values()}"""
)

for key in kwargs:
self.task_params.update({key: kwargs[key]})

def captcha_handler(self) -> CaptchaResponseSer:
"""
Sync solving method
Returns:
CaptchaResponseSer model with full service response
Notes:
Check class docstring for more info
"""
return self._processing_captcha(create_params=self.task_params)

async def aio_captcha_handler(self) -> CaptchaResponseSer:
"""
Async method for captcha solving
Returns:
CaptchaResponseSer model with full service response
Notes:
Check class docstring for more info
"""
return await self._aio_processing_captcha(create_params=self.task_params)
5 changes: 2 additions & 3 deletions src/python3_capsolver/binance.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from typing import Union

from python3_capsolver.core.base import BaseCaptcha
from python3_capsolver.core.enum import BinanceCaptchaTaskEnm
from python3_capsolver.core.serializer import CaptchaResponseSer, BinanceCaptchaTaskSer
from .core.enum import BinanceCaptchaTaskEnm
from .core.serializer import CaptchaResponseSer, BinanceCaptchaTaskSer


class Binance(BaseCaptcha):
Expand Down
Loading

0 comments on commit c7fba25

Please sign in to comment.