diff --git a/capmonster_python/__init__.py b/capmonster_python/__init__.py index 1c02d13..f209fd1 100644 --- a/capmonster_python/__init__.py +++ b/capmonster_python/__init__.py @@ -9,3 +9,4 @@ from .compleximage import ComplexImageTask from .datadome import DataDomeTask from .turnstile import TurnstileTask +from .tendi import TenDITask diff --git a/capmonster_python/compleximage.py b/capmonster_python/compleximage.py index ad9f0c3..d25b96e 100644 --- a/capmonster_python/compleximage.py +++ b/capmonster_python/compleximage.py @@ -2,6 +2,8 @@ class ComplexImageTask(UserAgent): + __VALID_CLASSES = ["recaptcha", "hcaptcha"] + def __init__(self, client_key): super(ComplexImageTask, self).__init__(client_key) @@ -11,7 +13,7 @@ def create_task(self, _class: str, grid: str = None, images_base64: list = None, task: str = None, websiteUrl: str = None): - if _class != "recaptcha" or _class != "hcaptcha": + if _class not in self.__VALID_CLASSES: raise ValueError("Currently only recaptcha or hcaptcha is supported as _class value.") data = { "clientKey": self._client_key, diff --git a/capmonster_python/tendi.py b/capmonster_python/tendi.py new file mode 100644 index 0000000..66d79bf --- /dev/null +++ b/capmonster_python/tendi.py @@ -0,0 +1,19 @@ +from .capmonster import UserAgent + +class TenDITask(UserAgent): + def __init__(self, client_key): + super(TenDITask, self).__init__(client_key) + + def create_task(self, website_url: str, website_key: str): + data = { + "clientKey": self._client_key, + "task": { + "type": "CustomTask", + "class": "TenDI", + "websiteURL": website_url, + "websiteKey": website_key + } + } + + data, is_user_agent = self._add_user_agent(data) + return self._make_request("createTask", data).get("taskId")