-
Notifications
You must be signed in to change notification settings - Fork 7
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 #133 from AndreiDrang/main
upd readme
- Loading branch information
Showing
19 changed files
with
701 additions
and
430 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,8 @@ | |
[](https://badge.fury.io/py/python3-capsolver) | ||
[](https://badge.fury.io/py/python3-capsolver) | ||
[](https://pepy.tech/project/python3-capsolver) | ||
[](https://andreidrang.github.io/python3-capsolver/) | ||
|
||
[](https://codeclimate.com/github/AndreiDrang/python3-capsolver/maintainability) | ||
[](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) | ||
[](https://codecov.io/gh/AndreiDrang/python3-capsolver) | ||
|
||
|
@@ -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+. | ||
|
@@ -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: [](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] |
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 |
---|---|---|
|
@@ -9,8 +9,8 @@ | |
[](https://badge.fury.io/py/python3-capsolver) | ||
[](https://badge.fury.io/py/python3-capsolver) | ||
[](https://pepy.tech/project/python3-capsolver) | ||
[](https://andreidrang.github.io/python3-capsolver/) | ||
|
||
[](https://codeclimate.com/github/AndreiDrang/python3-capsolver/maintainability) | ||
[](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) | ||
[](https://codecov.io/gh/AndreiDrang/python3-capsolver) | ||
|
||
|
@@ -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/). | ||
|
||
*** | ||
|
@@ -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] |
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 |
---|---|---|
@@ -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) |
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.