python3-capsolver 0.5.7__tar.gz → 0.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/PKG-INFO +27 -17
  2. python3-capsolver-0.6.1/python3_capsolver/__version__.py +1 -0
  3. python3-capsolver-0.6.1/python3_capsolver/cloudflare.py +120 -0
  4. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver/control.py +15 -26
  5. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver/core/base.py +0 -3
  6. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver/core/enum.py +13 -17
  7. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver/core/serializer.py +12 -8
  8. python3-capsolver-0.6.1/python3_capsolver/datadome_slider.py +104 -0
  9. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver/gee_test.py +0 -1
  10. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver/hcaptcha.py +0 -1
  11. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver/image_to_text.py +0 -1
  12. python3-capsolver-0.6.1/python3_capsolver/mt_captcha.py +124 -0
  13. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver/recaptcha.py +30 -0
  14. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver.egg-info/PKG-INFO +27 -17
  15. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver.egg-info/SOURCES.txt +1 -2
  16. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/setup.py +6 -2
  17. python3-capsolver-0.5.7/pyproject.toml +0 -29
  18. python3-capsolver-0.5.7/python3_capsolver/__version__.py +0 -1
  19. python3-capsolver-0.5.7/python3_capsolver/datadome_slider.py +0 -160
  20. python3-capsolver-0.5.7/python3_capsolver/kasada.py +0 -176
  21. python3-capsolver-0.5.7/python3_capsolver/mt_captcha.py +0 -170
  22. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver/__init__.py +0 -0
  23. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver/core/__init__.py +0 -0
  24. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver/core/config.py +0 -0
  25. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver/fun_captcha.py +0 -0
  26. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver.egg-info/dependency_links.txt +0 -0
  27. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver.egg-info/not-zip-safe +0 -0
  28. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver.egg-info/requires.txt +0 -0
  29. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/python3_capsolver.egg-info/top_level.txt +0 -0
  30. {python3-capsolver-0.5.7 → python3-capsolver-0.6.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python3-capsolver
3
- Version: 0.5.7
3
+ Version: 0.6.1
4
4
  Summary: Python 3.7+ Capsolver library with AIO module.
5
5
  Home-page: https://andreidrang.github.io/python3-capsolver/
6
6
  Author: AndreiDrang
@@ -13,16 +13,19 @@ Keywords: captcha
13
13
  geetest
14
14
  hcaptcha
15
15
  capypuzzle
16
- tiktok
17
16
  rotatecaptcha
18
17
  funcaptcha
19
18
  keycaptcha
20
19
  python3
21
20
  python-library
22
21
  capsolver
23
- kasada
24
22
  datadomeslider
23
+ datadome
25
24
  mtcaptcha
25
+ turnstile
26
+ cloudflare
27
+ amazon
28
+ amazon_waf
26
29
  Classifier: License :: OSI Approved :: MIT License
27
30
  Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
28
31
  Classifier: Development Status :: 5 - Production/Stable
@@ -33,6 +36,7 @@ Classifier: Programming Language :: Python :: 3.7
33
36
  Classifier: Programming Language :: Python :: 3.8
34
37
  Classifier: Programming Language :: Python :: 3.9
35
38
  Classifier: Programming Language :: Python :: 3.10
39
+ Classifier: Programming Language :: Python :: 3.11
36
40
  Classifier: Framework :: AsyncIO
37
41
  Classifier: Operating System :: Unix
38
42
  Classifier: Operating System :: Microsoft :: Windows
@@ -42,22 +46,23 @@ Description-Content-Type: text/markdown
42
46
 
43
47
 
44
48
  # python3-capsolver
45
- ![Python3-Capsolver](https://github.com/AndreiDrang/python3-capsolver/blob/main/files/CaptchaAISm.png)
49
+ ![Python3-Capsolver](https://github.com/AndreiDrang/python3-capsolver/blob/main/files/CapsolverSm.png)
46
50
 
47
51
  [![Capsolver](https://user-images.githubusercontent.com/16991365/234852229-6e4b3f3c-f498-4fd5-9a6b-f7f269dd4bfc.gif)](https://dashboard.capsolver.com/passport/register?inviteCode=kQTn-tG07Jb1)
48
52
 
49
- [![PyPI version](https://badge.fury.io/py/python3-captchaai.svg)](https://badge.fury.io/py/python3-captchaai)
50
- [![Python versions](https://img.shields.io/pypi/pyversions/python3-captchaai.svg?logo=python&logoColor=FBE072)](https://badge.fury.io/py/python3-captchaai)
51
- [![Downloads](https://pepy.tech/badge/python3-captchaai/month)](https://pepy.tech/project/python3-captchaai)
53
+ [![PyPI version](https://badge.fury.io/py/python3-capsolver.svg)](https://badge.fury.io/py/python3-capsolver)
54
+ [![Python versions](https://img.shields.io/pypi/pyversions/python3-capsolver.svg?logo=python&logoColor=FBE072)](https://badge.fury.io/py/python3-capsolver)
55
+ [![Downloads](https://pepy.tech/badge/python3-capsolver/month)](https://pepy.tech/project/python3-capsolver)
52
56
 
53
- [![Maintainability](https://api.codeclimate.com/v1/badges/3431fd3fe71baf7eb9da/maintainability)](https://codeclimate.com/github/AndreiDrang/python3-captchaai/maintainability)
54
- [![Codacy Badge](https://app.codacy.com/project/badge/Grade/323d4eda0fe1477bbea8fe8902b9e97e)](https://www.codacy.com/gh/AndreiDrang/python3-captchaai/dashboard?utm_source=github.com&utm_medium=referral&utm_content=AndreiDrang/python3-captchaai&utm_campaign=Badge_Grade)
55
- [![codecov](https://codecov.io/gh/AndreiDrang/python3-captchaai/branch/main/graph/badge.svg?token=2L4VVIF4G8)](https://codecov.io/gh/AndreiDrang/python3-captchaai)
57
+ [![Maintainability](https://api.codeclimate.com/v1/badges/3c30167b5fb37a0775ea/maintainability)](https://codeclimate.com/github/AndreiDrang/python3-capsolver/maintainability)
58
+ [![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)
59
+ [![codecov](https://codecov.io/gh/AndreiDrang/python3-capsolver/branch/main/graph/badge.svg?token=2L4VVIF4G8)](https://codecov.io/gh/AndreiDrang/python3-capsolver)
56
60
 
57
- [![Build check](https://github.com/AndreiDrang/python3-captchaai/actions/workflows/test_build.yml/badge.svg?branch=main)](https://github.com/AndreiDrang/python3-captchaai/actions/workflows/test_build.yml)
58
- [![Installation check](https://github.com/AndreiDrang/python3-captchaai/actions/workflows/install.yml/badge.svg?branch=main)](https://github.com/AndreiDrang/python3-captchaai/actions/workflows/install.yml)
59
- [![Test](https://github.com/AndreiDrang/python3-captchaai/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/AndreiDrang/python3-captchaai/actions/workflows/test.yml)
60
- [![Lint](https://github.com/AndreiDrang/python3-captchaai/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/AndreiDrang/python3-captchaai/actions/workflows/lint.yml)
61
+ [![Sphinx build](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/sphinx.yml/badge.svg?branch=release)](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/sphinx.yml)
62
+ [![Build](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/build.yml)
63
+ [![Installation](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/install.yml/badge.svg?branch=main)](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/install.yml)
64
+ [![Tests](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/test.yml)
65
+ [![Lint](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/AndreiDrang/python3-capsolver/actions/workflows/lint.yml)
61
66
 
62
67
 
63
68
  Python 3 library for [Capsolver](https://dashboard.capsolver.com/passport/register?inviteCode=kQTn-tG07Jb1) service API.
@@ -76,17 +81,17 @@ Or email python-captcha@pm.me
76
81
 
77
82
  ## How to install?
78
83
 
79
- We recommend using the latest version of Python. `python3-captchaai` supports Python 3.7+.
84
+ We recommend using the latest version of Python. `python3-capsolver` supports Python 3.7+.
80
85
 
81
86
  ### pip
82
87
 
83
88
  ```bash
84
- pip install python3-captchaai
89
+ pip install python3-capsolver
85
90
  ```
86
91
 
87
92
  ## How to use?
88
93
 
89
- Is described in the [documentation-website](https://andreidrang.github.io/python3-captchaai/).
94
+ Is described in the [documentation-website](https://andreidrang.github.io/python3-capsolver/).
90
95
 
91
96
 
92
97
  ## How to test?
@@ -94,6 +99,11 @@ Is described in the [documentation-website](https://andreidrang.github.io/python
94
99
  1. You need set ``API_KEY`` in your environment(get this value from you account).
95
100
  2. Run command ``make tests``, from root directory.
96
101
 
102
+
103
+ ### Changelog
104
+
105
+ Check [releases page](https://github.com/AndreiDrang/python3-capsolver/releases).
106
+
97
107
  ### How to get API Key to work with the library
98
108
  1. On the page - https://dashboard.capsolver.com/overview/user-center
99
109
  2. Find it: ![img.png](files/img.png)
@@ -0,0 +1 @@
1
+ __version__ = "0.6.1"
@@ -0,0 +1,120 @@
1
+ from typing import Dict, Union, Optional
2
+
3
+ from python3_capsolver.core.base import BaseCaptcha
4
+ from python3_capsolver.core.enum import CloudflareTypeEnm
5
+ from python3_capsolver.core.serializer import CaptchaResponseSer, CloudflareTurnstileSer
6
+
7
+
8
+ class Cloudflare(BaseCaptcha):
9
+ """
10
+ The class is used to work with Capsolver Cloudflare methods.
11
+
12
+ Args:
13
+ api_key: Capsolver API key
14
+ captcha_type: Captcha type name, like ``ReCaptchaV2Task`` and etc.
15
+ websiteURL: Address of a webpage with Google ReCaptcha
16
+ websiteKey: Recaptcha website key. <div class="g-recaptcha" data-sitekey="THAT_ONE"></div>
17
+ metadata: Extra data
18
+ html: You can pass in the entire html source code for the challenge directly.
19
+
20
+
21
+ Examples:
22
+ >>> Cloudflare(api_key="CAI-1324...",
23
+ ... captcha_type=CloudflareTypeEnm.AntiCloudflareTask,
24
+ ... websiteURL="https://bck.websiteurl.com/registry",
25
+ ... websiteKey='4ac25d',
26
+ ... proxy="socks5:158.120.100.23:334:user:pass",
27
+ ... metadata={'type': 'turnstile', 'acton':'login', 'cdata': '0000-1111-2222-3333-example-cdata'}
28
+ ... ).captcha_handler()
29
+ CaptchaResponseSer(errorId=False,
30
+ errorCode=None,
31
+ errorDescription=None,
32
+ taskId='73bdcd28-6c77-4414-8....',
33
+ status=<ResponseStatusEnm.Ready: 'ready'>,
34
+ solution={'gRecaptchaResponse': '44795sds...'}
35
+ )
36
+
37
+ >>> Cloudflare(api_key="CAI-1324...",
38
+ ... captcha_type=CloudflareTypeEnm.AntiCloudflareTask,
39
+ ... websiteURL="https://bck.websiteurl.com/registry",
40
+ ... proxy="socks5:158.120.100.23:334:user:pass",
41
+ ... metadata={'type': 'challenge'}
42
+ ... html="<your challenge html source code>",
43
+ ... ).captcha_handler()
44
+ CaptchaResponseSer(errorId=False,
45
+ errorCode=None,
46
+ errorDescription=None,
47
+ taskId='73bdcd28-6c77-4414-8....',
48
+ status=<ResponseStatusEnm.Ready: 'ready'>,
49
+ solution={'gRecaptchaResponse': '44795sds...'}
50
+ )
51
+
52
+ >>> await Cloudflare(api_key="CAI-1324...",
53
+ ... captcha_type=CloudflareTypeEnm.AntiCloudflareTask,
54
+ ... websiteURL="https://bck.websiteurl.com/registry",
55
+ ... websiteKey='4ac25d',
56
+ ... proxy="socks5:158.120.100.23:334:user:pass",
57
+ ... metadata={'type': 'challenge', 'acton':'login', 'cdata': '0000-1111-2222-3333-example-cdata'}
58
+ ... ).aio_captcha_handler()
59
+ CaptchaResponseSer(errorId=False,
60
+ errorCode=None,
61
+ errorDescription=None,
62
+ taskId='73bdcd28-6c77-4414-8....',
63
+ status=<ResponseStatusEnm.Ready: 'ready'>,
64
+ solution={'gRecaptchaResponse': '44795sds...'}
65
+ )
66
+
67
+ Returns:
68
+ CaptchaResponseSer model with full server response
69
+
70
+ Notes:
71
+ https://docs.capsolver.com/guide/antibots/cloudflare_turnstile.html
72
+ https://docs.capsolver.com/guide/antibots/cloudflare_challenge.html
73
+ """
74
+
75
+ def __init__(
76
+ self,
77
+ captcha_type: Union[CloudflareTypeEnm, str],
78
+ websiteURL: str,
79
+ metadata: Dict[str, str],
80
+ websiteKey: Optional[str] = None,
81
+ html: Optional[str] = None,
82
+ *args,
83
+ **kwargs,
84
+ ):
85
+ super().__init__(*args, **kwargs)
86
+
87
+ if captcha_type in CloudflareTypeEnm.list():
88
+ self.task_params = CloudflareTurnstileSer(**locals()).dict(exclude_none=True)
89
+ else:
90
+ raise ValueError(
91
+ f"""Invalid `captcha_type` parameter set for `{self.__class__.__name__}`,
92
+ available - {CloudflareTypeEnm.list()}"""
93
+ )
94
+ for key in kwargs:
95
+ self.task_params.update({key: kwargs[key]})
96
+
97
+ def captcha_handler(self) -> CaptchaResponseSer:
98
+ """
99
+ Sync method for captcha solving
100
+
101
+ Returns:
102
+ CaptchaResponseSer model with full service response
103
+
104
+ Notes:
105
+ Check class docstring for more info
106
+ """
107
+ return self._processing_captcha(create_params=self.task_params)
108
+
109
+ async def aio_captcha_handler(self) -> CaptchaResponseSer:
110
+ """
111
+ Async method for captcha solving
112
+
113
+
114
+ Returns:
115
+ CaptchaResponseSer model with full service response
116
+
117
+ Notes:
118
+ Check class docstring for more info
119
+ """
120
+ return await self._aio_processing_captcha(create_params=self.task_params)
@@ -1,52 +1,41 @@
1
1
  from python3_capsolver.core.base import BaseCaptcha
2
2
  from python3_capsolver.core.enum import EndpointPostfixEnm
3
- from python3_capsolver.core.config import REQUEST_URL
4
3
  from python3_capsolver.core.serializer import PostRequestSer, ControlResponseSer
5
4
 
6
5
 
7
- class BaseControl(BaseCaptcha):
6
+ class Control(BaseCaptcha):
8
7
  """
8
+ The class is used to work with Capsolver control methods.
9
+
9
10
  Args:
10
11
  api_key: Capsolver API key
11
- sleep_time: The waiting time between requests to get the result of the Captcha
12
- request_url: API address for sending requests
12
+
13
+ Notes:
14
+ https://docs.capsolver.com/guide/api-getbalance.html
13
15
  """
14
16
 
15
17
  serializer = PostRequestSer
16
18
 
17
19
  def __init__(
18
20
  self,
19
- api_key: str,
20
- sleep_time: int = 10,
21
- request_url: str = REQUEST_URL,
21
+ *args,
22
+ **kwargs,
22
23
  ):
23
-
24
- super().__init__(
25
- api_key=api_key, sleep_time=sleep_time, request_url=request_url, captcha_type="CaptchaTypeEnm.Control"
26
- )
27
-
28
-
29
- class Control(BaseControl):
30
- """
31
- The class is used to work with Capsolver control methods.
32
-
33
- Notes:
34
- https://captchaai.atlassian.net/wiki/spaces/CAPTCHAAI/pages/426042/API+Methods
35
- """
24
+ super().__init__(*args, **kwargs)
36
25
 
37
26
  def get_balance(self) -> ControlResponseSer:
38
27
  """
39
28
  Synchronous method to view the balance
40
29
 
41
30
  Examples:
42
- >>> Control(api_key="CAI-12345").get_balance()
43
- ResponseSer(balance=1.0 errorId=False errorCode=None errorDescription=None)
31
+ >>> Control(api_key="CAI-1324...").get_balance()
32
+ ControlResponseSer(errorId=0 errorCode=None errorDescription=None balance=150.9085)
44
33
 
45
34
  Returns:
46
35
  ResponseSer model with full server response
47
36
 
48
37
  Notes:
49
- https://captchaai.atlassian.net/wiki/spaces/CAPTCHAAI/pages/426080/getBalance+retrieve+account+balance
38
+ https://docs.capsolver.com/guide/api-getbalance.html
50
39
  """
51
40
  self._prepare_create_task_payload(serializer=self.serializer)
52
41
  return ControlResponseSer(
@@ -60,14 +49,14 @@ class Control(BaseControl):
60
49
  Asynchronous method to view the balance
61
50
 
62
51
  Examples:
63
- >>> await Control(api_key="CAI-12345").aio_get_balance()
64
- ResponseSer(balance=1.0 errorId=False errorCode=None errorDescription=None)
52
+ >>> await Control(api_key="CAI-1324...").aio_get_balance()
53
+ ControlResponseSer(errorId=0 errorCode=None errorDescription=None balance=150.9085)
65
54
 
66
55
  Returns:
67
56
  ResponseSer model with full server response
68
57
 
69
58
  Notes:
70
- https://captchaai.atlassian.net/wiki/spaces/CAPTCHAAI/pages/426080/getBalance+retrieve+account+balance
59
+ https://docs.capsolver.com/guide/api-getbalance.html
71
60
  """
72
61
  self._prepare_create_task_payload(serializer=self.serializer)
73
62
  return ControlResponseSer(
@@ -102,12 +102,9 @@ class BaseCaptcha:
102
102
  Function send SYNC request to service and wait for result
103
103
  """
104
104
  try:
105
- print(self.task_payload.dict(exclude_none=True))
106
105
  resp = self.__session.post(
107
106
  parse.urljoin(self.__request_url, url_postfix), json=self.task_payload.dict(exclude_none=True)
108
107
  )
109
- print(resp.status_code)
110
- print(resp.json())
111
108
  if resp.status_code in VALID_STATUS_CODES:
112
109
  return resp.json()
113
110
  else:
@@ -52,15 +52,12 @@ class CaptchaTypeEnmXXX(str, MyEnum):
52
52
  https://captchaai.atlassian.net/wiki/spaces/CAPTCHAAI/pages/393295
53
53
  """
54
54
 
55
- Control = "Control" # custom captcha type
56
55
  ImageToTextTask = "ImageToTextTask"
57
56
  # HCaptcha
58
57
  HCaptchaClassification = "HCaptchaClassification"
59
58
  # FunCaptcha
60
59
  FunCaptchaClassification = "FunCaptchaClassification"
61
60
  # Other types
62
- MtCaptchaTask = "MtCaptchaTask"
63
- DatadomeSliderTask = "DatadomeSliderTask"
64
61
  AntiKasadaTask = "AntiKasadaTask"
65
62
  AntiAkamaiBMPTask = "AntiAkamaiBMPTask"
66
63
 
@@ -99,6 +96,19 @@ class ReCaptchaV3TypeEnm(str, MyEnum):
99
96
  ReCaptchaV3EnterpriseTaskProxyLess = "ReCaptchaV3EnterpriseTaskProxyLess"
100
97
 
101
98
 
99
+ class MtCaptchaTypeEnm(str, MyEnum):
100
+ MtCaptchaTask = "MtCaptchaTask"
101
+ MtCaptchaTaskProxyLess = "MtCaptchaTaskProxyLess"
102
+
103
+
104
+ class DatadomeSliderTypeEnm(str, MyEnum):
105
+ DatadomeSliderTask = "DatadomeSliderTask"
106
+
107
+
108
+ class CloudflareTypeEnm(str, MyEnum):
109
+ AntiCloudflareTask = "AntiCloudflareTask"
110
+
111
+
102
112
  class ResponseStatusEnm(str, MyEnum):
103
113
  """
104
114
  Enum store results `status` field variants
@@ -111,17 +121,3 @@ class ResponseStatusEnm(str, MyEnum):
111
121
  Processing = "processing" # Task is not ready yet
112
122
  Ready = "ready" # Task completed, solution object can be found in solution property
113
123
  Failed = "failed" # Task failed, check the errorDescription to know why failed.
114
-
115
-
116
- class ProxyType(str, MyEnum):
117
- """
118
- Enum store proxy types
119
-
120
- Notes:
121
- https://captchaai.atlassian.net/wiki/spaces/CAPTCHAAI/pages/426124
122
- """
123
-
124
- http = "http" # usual http / https
125
- https = "https"
126
- socks4 = "socks4"
127
- socks5 = "socks5"
@@ -12,6 +12,7 @@ HTTP API Request ser
12
12
 
13
13
  class PostRequestSer(BaseModel):
14
14
  clientKey: str = Field(..., description="Client account key, can be found in user account")
15
+ task: dict = Field(None, description="Task object")
15
16
 
16
17
 
17
18
  class TaskSer(BaseModel):
@@ -19,7 +20,6 @@ class TaskSer(BaseModel):
19
20
 
20
21
 
21
22
  class RequestCreateTaskSer(PostRequestSer):
22
- task: dict = Field(None, description="Task object")
23
23
  appId: str = Field(APP_ID, description="AppID", const=True)
24
24
 
25
25
 
@@ -50,7 +50,6 @@ class CaptchaResponseSer(ResponseSer):
50
50
 
51
51
  class ControlResponseSer(ResponseSer):
52
52
  balance: Optional[float] = Field(0, description="Account balance value in USD")
53
- packages: List = Field(None, description="Monthly Packages")
54
53
 
55
54
 
56
55
  """
@@ -70,7 +69,7 @@ Captcha tasks ser
70
69
 
71
70
  class WebsiteDataOptionsSer(TaskSer):
72
71
  websiteURL: str = Field(..., description="Address of a webpage with Captcha")
73
- websiteKey: str = Field(..., description="Website key")
72
+ websiteKey: Optional[str] = Field(None, description="Website key")
74
73
 
75
74
 
76
75
  class ReCaptchaV3Ser(WebsiteDataOptionsSer):
@@ -107,13 +106,11 @@ class FunCaptchaSer(TaskSer):
107
106
  )
108
107
 
109
108
 
110
- class DatadomeSliderOptionsSer(BaseModel):
109
+ class DatadomeSliderSer(TaskSer):
111
110
  websiteURL: str = Field(..., description="Address of a webpage with DatadomeSlider")
112
111
  captchaUrl: str = Field(..., description="Captcha Url where is the captcha")
113
-
114
-
115
- class MtCaptchaOptionsSer(WebsiteDataOptionsSer):
116
- proxy: str = Field(..., description="String with proxy connection params, example: `198.22.3.1:10001:user:pwd`")
112
+ proxy: str = Field(..., description="Proxy data")
113
+ userAgent: str = Field(..., description="Browser's User-Agent which is used in emulation")
117
114
 
118
115
 
119
116
  class KasadaOptionsSer(BaseModel):
@@ -124,3 +121,10 @@ class KasadaOptionsSer(BaseModel):
124
121
  "This isn’t required if you are using proxies authenticated by IP",
125
122
  )
126
123
  proxyPassword: str = Field(..., description="This isn’t required if you are using proxies authenticated by IP")
124
+
125
+
126
+ class CloudflareTurnstileSer(WebsiteDataOptionsSer):
127
+ metadata: dict = Field(..., description="Extra data")
128
+ html: Optional[str] = Field(
129
+ None, description="You can pass in the entire html source code for the challenge directly."
130
+ )
@@ -0,0 +1,104 @@
1
+ from typing import Union
2
+
3
+ from python3_capsolver.core.base import BaseCaptcha
4
+ from python3_capsolver.core.enum import DatadomeSliderTypeEnm
5
+ from python3_capsolver.core.serializer import DatadomeSliderSer, CaptchaResponseSer
6
+
7
+
8
+ class DatadomeSlider(BaseCaptcha):
9
+ """
10
+ The class is used to work with Capsolver DatadomeSlider method.
11
+
12
+ Args:
13
+ api_key: Capsolver API key
14
+ websiteURL: Address of the webpage
15
+ captchaUrl: Captcha Url where is the captcha
16
+ proxy: Proxy data
17
+ userAgent: Browser's User-Agent which is used in emulation
18
+
19
+ Examples:
20
+ >>> DatadomeSlider(api_key="CAI-1324...",
21
+ ... captcha_type=DatadomeSliderTypeEnm.DatadomeSliderTask,
22
+ ... websiteURL="https://www.some-url.com/",
23
+ ... captchaUrl="https://www.some-url.com/to-page-with-captcha",
24
+ ... proxy="socks5:158.120.100.23:334:user:pass",
25
+ ... userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
26
+ ... ).captcha_handler()
27
+ CaptchaResponseSer(errorId=False,
28
+ errorCode=None,
29
+ errorDescription=None,
30
+ taskId='73bdcd28-6c77-4414-8....',
31
+ status=<ResponseStatusEnm.Ready: 'ready'>,
32
+ solution={'gRecaptchaResponse': '44795sds...'}
33
+ )
34
+
35
+ >>> await DatadomeSlider(api_key="CAI-1324...",
36
+ ... captcha_type="DatadomeSliderTask",
37
+ ... websiteURL="https://www.some-url.com/",
38
+ ... captchaUrl="https://www.some-url.com/to-page-with-captcha",
39
+ ... proxy="socks5:158.120.100.23:334:user:pass",
40
+ ... userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
41
+ ... ).aio_captcha_handler()
42
+ CaptchaResponseSer(errorId=False,
43
+ errorCode=None,
44
+ errorDescription=None,
45
+ taskId='73bdcd28-6c77-4414-8....',
46
+ status=<ResponseStatusEnm.Ready: 'ready'>,
47
+ solution={'gRecaptchaResponse': '44795sds...'}
48
+ )
49
+
50
+ Returns:
51
+ CaptchaResponseSer model with full server response
52
+
53
+ Notes:
54
+ https://docs.capsolver.com/guide/antibots/datadome.html
55
+ """
56
+
57
+ def __init__(
58
+ self,
59
+ captcha_type: Union[DatadomeSliderTypeEnm, str],
60
+ websiteURL: str,
61
+ captchaUrl: str,
62
+ proxy: str,
63
+ userAgent: str,
64
+ *args,
65
+ **kwargs,
66
+ ):
67
+ super().__init__(*args, **kwargs)
68
+
69
+ if captcha_type in DatadomeSliderTypeEnm.list():
70
+ self.task_params = DatadomeSliderSer(**locals()).dict()
71
+ else:
72
+ raise ValueError(
73
+ f"""Invalid `captcha_type` parameter set for `{self.__class__.__name__}`,
74
+ available - {DatadomeSliderTypeEnm.list()}"""
75
+ )
76
+ for key in kwargs:
77
+ self.task_params.update({key: kwargs[key]})
78
+
79
+ def captcha_handler(self) -> CaptchaResponseSer:
80
+ """
81
+ Sync method for captcha solving
82
+
83
+ Returns:
84
+ CaptchaResponseSer model with full service response
85
+
86
+ Notes:
87
+ Check class docstring for more info
88
+ """
89
+ return self._processing_captcha(create_params=self.task_params)
90
+
91
+ async def aio_captcha_handler(
92
+ self,
93
+ **additional_params,
94
+ ) -> CaptchaResponseSer:
95
+ """
96
+ Async method for captcha solving
97
+
98
+ Returns:
99
+ CaptchaResponseSer model with full service response
100
+
101
+ Notes:
102
+ Check class docstring for more info
103
+ """
104
+ return await self._aio_processing_captcha(create_params=self.task_params)
@@ -71,7 +71,6 @@ class GeeTest(BaseCaptcha):
71
71
  def __init__(
72
72
  self, captcha_type: Union[GeeTestCaptchaTypeEnm, str], websiteURL: str, gt: str, challenge: str, *args, **kwargs
73
73
  ):
74
-
75
74
  super().__init__(*args, **kwargs)
76
75
 
77
76
  if captcha_type in GeeTestCaptchaTypeEnm.list():
@@ -78,7 +78,6 @@ class HCaptcha(BaseCaptcha):
78
78
  """
79
79
 
80
80
  def __init__(self, captcha_type: Union[HCaptchaTypeEnm, str], websiteURL: str, websiteKey: str, *args, **kwargs):
81
-
82
81
  super().__init__(*args, **kwargs)
83
82
 
84
83
  if captcha_type in HCaptchaTypeEnm.list():
@@ -76,7 +76,6 @@ class BaseImageToText(BaseCaptcha):
76
76
  sleep_time: int = 10,
77
77
  request_url: str = REQUEST_URL,
78
78
  ):
79
-
80
79
  super().__init__(api_key=api_key, sleep_time=sleep_time, request_url=request_url)
81
80
 
82
81