Skip to content

Commit c7fba25

Browse files
authored
Merge pull request #133 from AndreiDrang/main
upd readme
2 parents e71f6bc + cc9f30d commit c7fba25

19 files changed

Lines changed: 701 additions & 430 deletions

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
[![PyPI version](https://badge.fury.io/py/python3-capsolver.svg)](https://badge.fury.io/py/python3-capsolver)
88
[![Python versions](https://img.shields.io/pypi/pyversions/python3-capsolver.svg?logo=python&logoColor=FBE072)](https://badge.fury.io/py/python3-capsolver)
99
[![Downloads](https://static.pepy.tech/badge/python3-capsolver/month)](https://pepy.tech/project/python3-capsolver)
10+
[![Static Badge](https://img.shields.io/badge/docs-Sphinx-green?label=Documentation&labelColor=gray)](https://andreidrang.github.io/python3-capsolver/)
1011

11-
[![Maintainability](https://api.codeclimate.com/v1/badges/3c30167b5fb37a0775ea/maintainability)](https://codeclimate.com/github/AndreiDrang/python3-capsolver/maintainability)
1212
[![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)
1313
[![codecov](https://codecov.io/gh/AndreiDrang/python3-capsolver/branch/main/graph/badge.svg?token=2L4VVIF4G8)](https://codecov.io/gh/AndreiDrang/python3-capsolver)
1414

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

2626
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.
2727

28-
***
29-
30-
If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.
31-
32-
Or email python-captcha@pm.me
33-
3428
## How to install?
3529

3630
We recommend using the latest version of Python. `python3-capsolver` supports Python 3.7+.
@@ -59,3 +53,9 @@ Check [releases page](https://github.com/AndreiDrang/python3-capsolver/releases)
5953
### How to get API Key to work with the library
6054
1. On the page - https://dashboard.capsolver.com/overview/user-center
6155
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)
56+
57+
### Contacts
58+
59+
If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.
60+
61+
Or email python-captcha@pm.me

docs/modules/main/info.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
[![PyPI version](https://badge.fury.io/py/python3-capsolver.svg)](https://badge.fury.io/py/python3-capsolver)
1010
[![Python versions](https://img.shields.io/pypi/pyversions/python3-capsolver.svg?logo=python&logoColor=FBE072)](https://badge.fury.io/py/python3-capsolver)
1111
[![Downloads](https://pepy.tech/badge/python3-capsolver/month)](https://pepy.tech/project/python3-capsolver)
12+
[![Static Badge](https://img.shields.io/badge/docs-Sphinx-green?label=Documentation&labelColor=gray)](https://andreidrang.github.io/python3-capsolver/)
1213

13-
[![Maintainability](https://api.codeclimate.com/v1/badges/3c30167b5fb37a0775ea/maintainability)](https://codeclimate.com/github/AndreiDrang/python3-capsolver/maintainability)
1414
[![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)
1515
[![codecov](https://codecov.io/gh/AndreiDrang/python3-capsolver/branch/main/graph/badge.svg?token=2L4VVIF4G8)](https://codecov.io/gh/AndreiDrang/python3-capsolver)
1616

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

2828
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.
2929

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

3432
***
@@ -59,3 +57,9 @@ python setup.py install
5957
### Changelog
6058

6159
Check [releases page](https://github.com/AndreiDrang/python3-capsolver/releases).
60+
61+
### Contacts
62+
63+
If you have any questions, please send a message to the [Telegram](https://t.me/pythoncaptcha) chat room.
64+
65+
Or email python-captcha@pm.me

docs/modules/other-libs/info.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@
44
1. [RuCaptcha / 2Captcha](https://github.com/AndreiDrang/python-rucaptcha)
55
2. [AntiCaptcha](https://github.com/AndreiDrang/python3-anticaptcha)
66
3. [Capsolver](https://github.com/AndreiDrang/python3-capsolver)
7-
4. [RedPandaDev group](https://red-panda-dev.xyz/)
7+
8+
## Rust
9+
1. [Rust-AntiCaptcha crate](https://crates.io/crates/rust-anticaptcha)
10+
11+
Our other projects:
12+
- [RedPandaDev group](https://red-panda-dev.xyz/blog/)
13+

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ sphinx==8.1.3
22
pallets_sphinx_themes==2.3.0
33
myst-parser==4.0.0
44
autodoc_pydantic==2.2.0
5-
pydantic==2.10.3
5+
pydantic==2.10.4
66
pydantic-settings==2.7.0

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ classifiers = [
8585
dependencies = [
8686
"requests>=2.21.0",
8787
"aiohttp>=3.9.2",
88-
"pydantic>=2.5.0",
88+
"msgspec>=0.18,<0.20",
8989
"tenacity>=8,<10"
9090
]
9191

src/python3_capsolver/akamai.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
from typing import Union
22

3-
from python3_capsolver.core.base import BaseCaptcha
4-
from python3_capsolver.core.enum import AntiAkamaiTaskEnm, EndpointPostfixEnm
5-
from python3_capsolver.core.serializer import (
6-
PostRequestSer,
7-
CaptchaResponseSer,
8-
AntiAkamaiBMPTaskSer,
9-
AntiAkamaiWebTaskSer,
10-
)
3+
from .core.base import CaptchaParams
4+
from .core.enum import AntiAkamaiTaskEnm, EndpointPostfixEnm
5+
from .core.serializer import PostRequestSer, CaptchaResponseSer, AntiAkamaiBMPTaskSer, AntiAkamaiWebTaskSer
116

127

13-
class Akamai(BaseCaptcha):
8+
class Akamai(CaptchaParams):
149
"""
1510
The class is used to work with Capsolver AntiAkamai methods.
1611

src/python3_capsolver/aws_waf.py

Lines changed: 82 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,96 @@
1-
from typing import Union
1+
from typing import Union, Optional
22

3-
from python3_capsolver.core.base import BaseCaptcha
4-
from python3_capsolver.core.enum import AntiAwsWafTaskTypeEnm
5-
from python3_capsolver.core.serializer import CaptchaResponseSer, WebsiteDataOptionsSer
3+
from .core.base import CaptchaParams
4+
from .core.enum import AntiAwsWafTaskTypeEnm
65

6+
__all__ = ("AwsWaf",)
77

8-
class AwsWaf(BaseCaptcha):
9-
"""
10-
The class is used to work with Capsolver AwsWaf methods.
118

12-
Args:
13-
api_key: Capsolver API key
14-
captcha_type: Captcha type name, like ``AntiAwsWafTask`` and etc.
15-
websiteURL: Address of a webpage with AwsWaf
16-
17-
Examples:
18-
>>> AwsWaf(api_key="CAI-BA9XXXXXXXXXXXXX2702E010",
19-
... captcha_type='AntiAwsWafTaskProxyLess',
20-
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
21-
... ).captcha_handler()
22-
CaptchaResponseSer(errorId=0,
23-
errorCode=None,
24-
errorDescription=None,
25-
taskId='73bdcd28-6c77-4414-8....',
26-
status=<ResponseStatusEnm.Ready: 'ready'>,
27-
solution={'cookie': '44795sds...'}
28-
)
29-
30-
>>> AwsWaf(api_key="CAI-BA9XXXXXXXXXXXXX2702E010",
31-
... captcha_type=AntiAwsWafTaskTypeEnm.AntiAwsWafTaskProxyLess,
32-
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
33-
... ).captcha_handler()
34-
CaptchaResponseSer(errorId=0,
35-
errorCode=None,
36-
errorDescription=None,
37-
taskId='73bdcd28-6c77-4414-8....',
38-
status=<ResponseStatusEnm.Ready: 'ready'>,
39-
solution={'cookie': '44795sds...'}
40-
)
41-
42-
>>> AwsWaf(api_key="CAI-BA9XXXXXXXXXXXXX2702E010",
43-
... captcha_type=AntiAwsWafTaskTypeEnm.AntiAwsWafTask,
44-
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
45-
... proxy="socks5:192.191.100.10:4780:user:pwd",
46-
... awsKey="some key"
47-
... ).captcha_handler()
48-
CaptchaResponseSer(errorId=0,
49-
errorCode=None,
50-
errorDescription=None,
51-
taskId="87f149f4-1c....",
52-
status=<ResponseStatusEnm.Ready: 'ready'>,
53-
solution={'cookie': '44795sds...'}
54-
)
55-
56-
>>> await AwsWaf(api_key="CAI-BA9650D2B9C2786B21120D512702E010",
57-
... captcha_type=AntiAwsWafTaskTypeEnm.AntiAwsWafTaskProxyLess,
58-
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
59-
... ).aio_captcha_handler()
60-
CaptchaResponseSer(errorId=0,
61-
errorCode=None,
62-
errorDescription=None,
63-
taskId='73bdcd28-6c77-4414-8....',
64-
status=<ResponseStatusEnm.Ready: 'ready'>,
65-
solution={'cookie': '44795sds...'}
66-
)
9+
class AwsWaf(CaptchaParams):
10+
def __init__(
11+
self,
12+
api_key: str,
13+
captcha_type: Union[AntiAwsWafTaskTypeEnm, str],
14+
websiteURL: str,
15+
sleep_time: Optional[int] = 10,
16+
**additional_params,
17+
):
18+
"""
19+
The class is used to work with Capsolver AwsWaf methods.
20+
21+
Args:
22+
api_key: Capsolver API key
23+
captcha_type: Captcha type name, like ``AntiAwsWafTask`` and etc.
24+
websiteURL: Address of a webpage with AwsWaf
25+
additional_params: Some additional parameters that will be used in creating the task
26+
and will be passed to the payload under ``task`` key.
27+
Like ``proxyLogin``, ``proxyPassword`` and etc. - more info in service docs
28+
29+
30+
Examples:
31+
>>> AwsWaf(api_key="CAI-BA9XXXXXXXXXXXXX2702E010",
32+
... captcha_type='AntiAwsWafTaskProxyLess',
33+
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
34+
... ).captcha_handler()
35+
CaptchaResponseSer(errorId=0,
36+
errorCode=None,
37+
errorDescription=None,
38+
taskId='73bdcd28-6c77-4414-8....',
39+
status=<ResponseStatusEnm.Ready: 'ready'>,
40+
solution={'cookie': '44795sds...'}
41+
)
42+
43+
>>> AwsWaf(api_key="CAI-BA9XXXXXXXXXXXXX2702E010",
44+
... captcha_type=AntiAwsWafTaskTypeEnm.AntiAwsWafTaskProxyLess,
45+
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
46+
... ).captcha_handler()
47+
CaptchaResponseSer(errorId=0,
48+
errorCode=None,
49+
errorDescription=None,
50+
taskId='73bdcd28-6c77-4414-8....',
51+
status=<ResponseStatusEnm.Ready: 'ready'>,
52+
solution={'cookie': '44795sds...'}
53+
)
54+
55+
>>> AwsWaf(api_key="CAI-BA9XXXXXXXXXXXXX2702E010",
56+
... captcha_type=AntiAwsWafTaskTypeEnm.AntiAwsWafTask,
57+
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
58+
... proxy="socks5:192.191.100.10:4780:user:pwd",
59+
... awsKey="some key"
60+
... ).captcha_handler()
61+
CaptchaResponseSer(errorId=0,
62+
errorCode=None,
63+
errorDescription=None,
64+
taskId="87f149f4-1c....",
65+
status=<ResponseStatusEnm.Ready: 'ready'>,
66+
solution={'cookie': '44795sds...'}
67+
)
68+
69+
>>> await AwsWaf(api_key="CAI-BA9650D2B9C2786B21120D512702E010",
70+
... captcha_type=AntiAwsWafTaskTypeEnm.AntiAwsWafTaskProxyLess,
71+
... websiteURL="https://efw47fpad9.execute-api.us-east-1.amazonaws.com/latest",
72+
... ).aio_captcha_handler()
73+
CaptchaResponseSer(errorId=0,
74+
errorCode=None,
75+
errorDescription=None,
76+
taskId='73bdcd28-6c77-4414-8....',
77+
status=<ResponseStatusEnm.Ready: 'ready'>,
78+
solution={'cookie': '44795sds...'}
79+
)
6780
68-
Returns:
69-
CaptchaResponseSer model with full server response
81+
Returns:
82+
CaptchaResponseSer model with full server response
7083
71-
Notes:
72-
https://docs.capsolver.com/guide/captcha/awsWaf.html
73-
"""
84+
Notes:
85+
https://docs.capsolver.com/guide/captcha/awsWaf.html
86+
"""
7487

75-
def __init__(self, captcha_type: Union[AntiAwsWafTaskTypeEnm, str], websiteURL: str, *args, **kwargs):
76-
super().__init__(*args, **kwargs)
88+
super().__init__(api_key=api_key, sleep_time=sleep_time)
7789

7890
if captcha_type in AntiAwsWafTaskTypeEnm.list():
79-
self.task_params = WebsiteDataOptionsSer(**locals()).dict()
91+
self.task_params.update(dict(type=captcha_type, websiteURL=websiteURL, **additional_params))
8092
else:
8193
raise ValueError(
8294
f"""Invalid `captcha_type` parameter set for `{self.__class__.__name__}`,
8395
available - {AntiAwsWafTaskTypeEnm.list_values()}"""
8496
)
85-
86-
for key in kwargs:
87-
self.task_params.update({key: kwargs[key]})
88-
89-
def captcha_handler(self) -> CaptchaResponseSer:
90-
"""
91-
Sync solving method
92-
93-
Returns:
94-
CaptchaResponseSer model with full service response
95-
96-
Notes:
97-
Check class docstring for more info
98-
"""
99-
return self._processing_captcha(create_params=self.task_params)
100-
101-
async def aio_captcha_handler(self) -> CaptchaResponseSer:
102-
"""
103-
Async method for captcha solving
104-
105-
Returns:
106-
CaptchaResponseSer model with full service response
107-
108-
Notes:
109-
Check class docstring for more info
110-
"""
111-
return await self._aio_processing_captcha(create_params=self.task_params)

src/python3_capsolver/binance.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from typing import Union
22

3-
from python3_capsolver.core.base import BaseCaptcha
4-
from python3_capsolver.core.enum import BinanceCaptchaTaskEnm
5-
from python3_capsolver.core.serializer import CaptchaResponseSer, BinanceCaptchaTaskSer
3+
from .core.enum import BinanceCaptchaTaskEnm
4+
from .core.serializer import CaptchaResponseSer, BinanceCaptchaTaskSer
65

76

87
class Binance(BaseCaptcha):

0 commit comments

Comments
 (0)