2captcha-python 1.4.0__tar.gz → 1.5.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 (37) hide show
  1. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/2captcha_python.egg-info/PKG-INFO +36 -38
  2. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/2captcha_python.egg-info/SOURCES.txt +1 -0
  3. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/PKG-INFO +36 -38
  4. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/README.md +24 -36
  5. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/setup.py +1 -1
  6. 2captcha_python-1.5.1/tests/test_yandex_smart_captcha.py +29 -0
  7. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/twocaptcha/__init__.py +2 -2
  8. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/twocaptcha/solver.py +65 -10
  9. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/2captcha_python.egg-info/dependency_links.txt +0 -0
  10. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/2captcha_python.egg-info/requires.txt +0 -0
  11. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/2captcha_python.egg-info/top_level.txt +0 -0
  12. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/LICENSE +0 -0
  13. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/setup.cfg +0 -0
  14. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_amazon_waf.py +0 -0
  15. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_atb_captcha.py +0 -0
  16. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_canvas.py +0 -0
  17. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_capy.py +0 -0
  18. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_coordinates.py +0 -0
  19. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_cutcaptcha.py +0 -0
  20. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_cybersiara.py +0 -0
  21. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_datadome.py +0 -0
  22. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_friendly_captcha.py +0 -0
  23. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_funcaptcha.py +0 -0
  24. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_geetest.py +0 -0
  25. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_geetest_v4.py +0 -0
  26. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_grid.py +0 -0
  27. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_hcaptcha.py +0 -0
  28. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_keycaptcha.py +0 -0
  29. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_lemin.py +0 -0
  30. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_mtcaptcha.py +0 -0
  31. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_normal.py +0 -0
  32. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_recaptcha.py +0 -0
  33. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_rotate.py +0 -0
  34. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_tencent.py +0 -0
  35. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_text.py +0 -0
  36. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/tests/test_turnstile.py +0 -0
  37. {2captcha_python-1.4.0 → 2captcha_python-1.5.1}/twocaptcha/api.py +0 -0
@@ -1,11 +1,11 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: 2captcha-python
3
- Version: 1.4.0
3
+ Version: 1.5.1
4
4
  Summary: Python module for easy integration with 2Captcha API
5
5
  Home-page: https://github.com/2captcha/2captcha-python/
6
6
  Author: 2Captcha
7
7
  Author-email: info@2captcha.com
8
- Keywords: 2captcha,captcha,api,captcha solver,reCAPTCHA,hCaptcha,FunCaptcha,Geetest,image captcha,Coordinates,Click Captcha,Geetest V4,Lemin captcha,Amazon WAF,Cloudflare Turnstile,Capy Puzzle,MTCaptcha,Friendly Captcha,Tencent,Cutcaptcha,DataDome,cybersiara
8
+ Keywords: 2captcha,captcha,api,captcha solver,reCAPTCHA,FunCaptcha,Geetest,image captcha,Coordinates,Click Captcha,Geetest V4,Lemin captcha,Amazon WAF,Cloudflare Turnstile,Capy Puzzle,MTCaptcha,Friendly Captcha,Tencent,Cutcaptcha,DataDome,cybersiara
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Operating System :: OS Independent
@@ -17,6 +17,16 @@ Requires-Python: >=3.6
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
19
  Requires-Dist: requests
20
+ Dynamic: author
21
+ Dynamic: author-email
22
+ Dynamic: classifier
23
+ Dynamic: description
24
+ Dynamic: description-content-type
25
+ Dynamic: home-page
26
+ Dynamic: keywords
27
+ Dynamic: requires-dist
28
+ Dynamic: requires-python
29
+ Dynamic: summary
20
30
 
21
31
  <a href="https://github.com/2captcha/2captcha-python"><img src="https://github.com/user-attachments/assets/a737d428-5233-4605-9d09-211fa213d069" width="82" height="30"></a>
22
32
  <a href="https://github.com/2captcha/2captcha-javascript"><img src="https://github.com/user-attachments/assets/4d3b4541-34b2-4ed2-a687-d694ce67e5a6" width="36" height="30"></a>
@@ -46,7 +56,7 @@ Examples of API requests for different captcha types are available on the [Pytho
46
56
  - [FunCaptcha](#funcaptcha)
47
57
  - [GeeTest](#geetest)
48
58
  - [GeeTest v4](#geetest-v4)
49
- - [hCaptcha](#hcaptcha)
59
+ - [Yandex Smart](#yandex-smart)
50
60
  - [Lemin Cropped Captcha](#lemin-cropped-captcha)
51
61
  - [Cloudflare Turnstile](#cloudflare-turnstile)
52
62
  - [Amazon WAF](#amazon-waf)
@@ -61,10 +71,10 @@ Examples of API requests for different captcha types are available on the [Pytho
61
71
  - [Friendly Captcha](#friendly-captcha)
62
72
  - [Cutcaptcha](#cutcaptcha)
63
73
  - [Tencent](#tencent)
64
- - [Datadome](#datadome)
74
+ - [DataDome](#datadome)
65
75
  - [CyberSiARA](#cybersiara)
66
76
  - [Other methods](#other-methods)
67
- - [send / get_result](#send--get_result)
77
+ - [send / get\_result](#send--get_result)
68
78
  - [balance](#balance)
69
79
  - [report](#report)
70
80
  - [Error handling](#error-handling)
@@ -73,10 +83,10 @@ Examples of API requests for different captcha types are available on the [Pytho
73
83
  - [Examples](#examples)
74
84
  - [Examples using Selenium](#examples-using-selenium)
75
85
  - [Useful articles](#useful-articles)
76
- - [Get in touch](#get-in-touch)
77
- - [Join the team 👪](#join-the-team-)
78
- - [License](#license)
79
- - [Graphics and Trademarks](#graphics-and-trademarks)
86
+ - [Get in touch](#get-in-touch)
87
+ - [Join the team 👪](#join-the-team-)
88
+ - [License](#license)
89
+ - [Graphics and Trademarks](#graphics-and-trademarks)
80
90
 
81
91
  ## Installation
82
92
 
@@ -107,6 +117,7 @@ config = {
107
117
  'defaultTimeout': 120,
108
118
  'recaptchaTimeout': 600,
109
119
  'pollingInterval': 10,
120
+ 'extendedResponse': False
110
121
  }
111
122
  solver = TwoCaptcha(**config)
112
123
  ```
@@ -121,6 +132,8 @@ solver = TwoCaptcha(**config)
121
132
  | defaultTimeout | 120 | Polling timeout in seconds for all captcha types except reCAPTCHA. Defines how long the module tries to get the answer from the `res.php` API endpoint |
122
133
  | recaptchaTimeout | 600 | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from the `res.php` API endpoint |
123
134
  | pollingInterval | 10 | Interval in seconds between requests to the `res.php` API endpoint. Setting values less than 5 seconds is not recommended |
135
+ | extendedResponse | None | Set to `True` to get the response with additional fields or in more practical format (enables `JSON` response from `res.php` API endpoint). Suitable for [ClickCaptcha](#clickcaptcha), [Canvas](#canvas) |
136
+
124
137
 
125
138
  > [!IMPORTANT]
126
139
  > Once `callback` is defined for the `TwoCaptcha` instance, all methods return only the captcha ID and DO NOT poll the API to get the result. The result will be sent to the callback URL.
@@ -243,19 +256,6 @@ result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
243
256
  ```
244
257
 
245
258
 
246
- ### hCaptcha
247
-
248
- <sup>[API method description.](https://2captcha.com/2captcha-api#solving_hcaptcha)</sup>
249
-
250
- Use this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.
251
- ```python
252
- result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
253
- url='https://www.site.com/page/',
254
- param1=..., ...)
255
-
256
- ```
257
-
258
-
259
259
  ### Lemin Cropped Captcha
260
260
 
261
261
  <sup>[API method description.](https://2captcha.com/2captcha-api#lemin)</sup>
@@ -269,6 +269,15 @@ result = solver.lemin(captcha_id='CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d90
269
269
 
270
270
  ```
271
271
 
272
+ ### Yandex Smart
273
+
274
+ Use this method to solve Yandex Smart Captcha. Returns JSON with the token.
275
+ ```python
276
+ result = solver.yandex_smart(sitekey='0x1AAAAh45AAAAkg0s2VIOD34y5hy4h4h',
277
+ url='http://mysite.com/',
278
+ proxy={'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'},
279
+ userAgent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36')
280
+ ```
272
281
 
273
282
  ### Cloudflare Turnstile
274
283
 
@@ -422,7 +431,7 @@ result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320'
422
431
 
423
432
  <sup>[API method description.](https://2captcha.com/2captcha-api#tencent)</sup>
424
433
 
425
- Use this method to solve Cutcaptcha. Returns a token.
434
+ Use this method to solve Tencent captcha. Returns a token.
426
435
  ```python
427
436
  result = solver.tencent(app_id="197326679",
428
437
  url="https://mysite.com/page/with/tencent",
@@ -465,7 +474,7 @@ result = solver.cybersiara(master_url_id='tpjOCKjjpdzv3d8Ub2E9COEWKt1vl1Mv',
465
474
 
466
475
  ### send / get_result
467
476
  These methods can be used for manual captcha submission and answer polling. The `send()` method supports sending any captcha
468
- type, to specify the captcha type you must send value `method` manually, for example `method='hcaptcha'` for solving hCapthca.
477
+ type, to specify the captcha type you must send value `method` manually, for example `method='recaptcha'` for solving reCaptcha.
469
478
  You can find the value of the `method` parameter in the [API documentation](https://2captcha.com/2captcha-api).
470
479
 
471
480
  Example for solving Normal captcha manually:
@@ -477,17 +486,6 @@ import time
477
486
  id = solver.send(file='path/to/captcha.jpg')
478
487
  time.sleep(20)
479
488
 
480
- code = solver.get_result(id)
481
- ```
482
- Example for solving hCaptcha manually:
483
- ```python
484
- import time
485
- . . . . .
486
- id = solver.send(sitekey='41b778e7-8f20-45cc-a804-1f1ebb45c579',
487
- url='https://2captcha.com/demo/hcaptcha?difficulty=easy',
488
- method='hcaptcha')
489
- print(id)
490
- time.sleep(20)
491
489
  code = solver.get_result(id)
492
490
  ```
493
491
 
@@ -533,7 +531,7 @@ except TimeoutException as e:
533
531
 
534
532
  ## Proxies
535
533
 
536
- You can pass your proxy as an additional argument for the following methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha,
534
+ You can pass your proxy as an additional argument for the following methods: recaptcha, funcaptcha, geetest, geetest v4,
537
535
  keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, amazon waf, mtcaptcha, friendly captcha, cutcaptcha, Tencent, DataDome, cybersiara.
538
536
 
539
537
 
@@ -571,7 +569,7 @@ captcha_result = asyncio.run(captchaSolver(image))
571
569
  Examples of solving all supported captcha types are located in the [examples] directory.
572
570
 
573
571
  ## Examples using Selenium
574
- Also we have a [separate repository](https://github.com/2captcha/captcha-solver-selenium-python-examples) you can find examples of captcha solving using [Selenium](https://pypi.org/project/selenium/) library. At the moment we have implemented examples of bypassing [reCAPTCHA](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/reCAPTCHA), [hCaptcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/hCaptcha), [normal captcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/normal_captcha) (image captcha) and [text captcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/text_captcha) using Selenium.
572
+ Also we have a [separate repository](https://github.com/2captcha/captcha-solver-selenium-python-examples) you can find examples of captcha solving using [Selenium](https://pypi.org/project/selenium/) library. At the moment we have implemented examples of bypassing [reCAPTCHA](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/reCAPTCHA), [Cloudflare](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/cloudflare), [Coordinates](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/coordinates), [MTCaptcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/mtcaptcha), [normal captcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/normal_captcha) (image captcha) and [text captcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/text_captcha) using Selenium.
575
573
 
576
574
  ## Useful articles
577
575
 
@@ -29,6 +29,7 @@ tests/test_rotate.py
29
29
  tests/test_tencent.py
30
30
  tests/test_text.py
31
31
  tests/test_turnstile.py
32
+ tests/test_yandex_smart_captcha.py
32
33
  twocaptcha/__init__.py
33
34
  twocaptcha/api.py
34
35
  twocaptcha/solver.py
@@ -1,11 +1,11 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: 2captcha-python
3
- Version: 1.4.0
3
+ Version: 1.5.1
4
4
  Summary: Python module for easy integration with 2Captcha API
5
5
  Home-page: https://github.com/2captcha/2captcha-python/
6
6
  Author: 2Captcha
7
7
  Author-email: info@2captcha.com
8
- Keywords: 2captcha,captcha,api,captcha solver,reCAPTCHA,hCaptcha,FunCaptcha,Geetest,image captcha,Coordinates,Click Captcha,Geetest V4,Lemin captcha,Amazon WAF,Cloudflare Turnstile,Capy Puzzle,MTCaptcha,Friendly Captcha,Tencent,Cutcaptcha,DataDome,cybersiara
8
+ Keywords: 2captcha,captcha,api,captcha solver,reCAPTCHA,FunCaptcha,Geetest,image captcha,Coordinates,Click Captcha,Geetest V4,Lemin captcha,Amazon WAF,Cloudflare Turnstile,Capy Puzzle,MTCaptcha,Friendly Captcha,Tencent,Cutcaptcha,DataDome,cybersiara
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Operating System :: OS Independent
@@ -17,6 +17,16 @@ Requires-Python: >=3.6
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
19
  Requires-Dist: requests
20
+ Dynamic: author
21
+ Dynamic: author-email
22
+ Dynamic: classifier
23
+ Dynamic: description
24
+ Dynamic: description-content-type
25
+ Dynamic: home-page
26
+ Dynamic: keywords
27
+ Dynamic: requires-dist
28
+ Dynamic: requires-python
29
+ Dynamic: summary
20
30
 
21
31
  <a href="https://github.com/2captcha/2captcha-python"><img src="https://github.com/user-attachments/assets/a737d428-5233-4605-9d09-211fa213d069" width="82" height="30"></a>
22
32
  <a href="https://github.com/2captcha/2captcha-javascript"><img src="https://github.com/user-attachments/assets/4d3b4541-34b2-4ed2-a687-d694ce67e5a6" width="36" height="30"></a>
@@ -46,7 +56,7 @@ Examples of API requests for different captcha types are available on the [Pytho
46
56
  - [FunCaptcha](#funcaptcha)
47
57
  - [GeeTest](#geetest)
48
58
  - [GeeTest v4](#geetest-v4)
49
- - [hCaptcha](#hcaptcha)
59
+ - [Yandex Smart](#yandex-smart)
50
60
  - [Lemin Cropped Captcha](#lemin-cropped-captcha)
51
61
  - [Cloudflare Turnstile](#cloudflare-turnstile)
52
62
  - [Amazon WAF](#amazon-waf)
@@ -61,10 +71,10 @@ Examples of API requests for different captcha types are available on the [Pytho
61
71
  - [Friendly Captcha](#friendly-captcha)
62
72
  - [Cutcaptcha](#cutcaptcha)
63
73
  - [Tencent](#tencent)
64
- - [Datadome](#datadome)
74
+ - [DataDome](#datadome)
65
75
  - [CyberSiARA](#cybersiara)
66
76
  - [Other methods](#other-methods)
67
- - [send / get_result](#send--get_result)
77
+ - [send / get\_result](#send--get_result)
68
78
  - [balance](#balance)
69
79
  - [report](#report)
70
80
  - [Error handling](#error-handling)
@@ -73,10 +83,10 @@ Examples of API requests for different captcha types are available on the [Pytho
73
83
  - [Examples](#examples)
74
84
  - [Examples using Selenium](#examples-using-selenium)
75
85
  - [Useful articles](#useful-articles)
76
- - [Get in touch](#get-in-touch)
77
- - [Join the team 👪](#join-the-team-)
78
- - [License](#license)
79
- - [Graphics and Trademarks](#graphics-and-trademarks)
86
+ - [Get in touch](#get-in-touch)
87
+ - [Join the team 👪](#join-the-team-)
88
+ - [License](#license)
89
+ - [Graphics and Trademarks](#graphics-and-trademarks)
80
90
 
81
91
  ## Installation
82
92
 
@@ -107,6 +117,7 @@ config = {
107
117
  'defaultTimeout': 120,
108
118
  'recaptchaTimeout': 600,
109
119
  'pollingInterval': 10,
120
+ 'extendedResponse': False
110
121
  }
111
122
  solver = TwoCaptcha(**config)
112
123
  ```
@@ -121,6 +132,8 @@ solver = TwoCaptcha(**config)
121
132
  | defaultTimeout | 120 | Polling timeout in seconds for all captcha types except reCAPTCHA. Defines how long the module tries to get the answer from the `res.php` API endpoint |
122
133
  | recaptchaTimeout | 600 | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from the `res.php` API endpoint |
123
134
  | pollingInterval | 10 | Interval in seconds between requests to the `res.php` API endpoint. Setting values less than 5 seconds is not recommended |
135
+ | extendedResponse | None | Set to `True` to get the response with additional fields or in more practical format (enables `JSON` response from `res.php` API endpoint). Suitable for [ClickCaptcha](#clickcaptcha), [Canvas](#canvas) |
136
+
124
137
 
125
138
  > [!IMPORTANT]
126
139
  > Once `callback` is defined for the `TwoCaptcha` instance, all methods return only the captcha ID and DO NOT poll the API to get the result. The result will be sent to the callback URL.
@@ -243,19 +256,6 @@ result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
243
256
  ```
244
257
 
245
258
 
246
- ### hCaptcha
247
-
248
- <sup>[API method description.](https://2captcha.com/2captcha-api#solving_hcaptcha)</sup>
249
-
250
- Use this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.
251
- ```python
252
- result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
253
- url='https://www.site.com/page/',
254
- param1=..., ...)
255
-
256
- ```
257
-
258
-
259
259
  ### Lemin Cropped Captcha
260
260
 
261
261
  <sup>[API method description.](https://2captcha.com/2captcha-api#lemin)</sup>
@@ -269,6 +269,15 @@ result = solver.lemin(captcha_id='CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d90
269
269
 
270
270
  ```
271
271
 
272
+ ### Yandex Smart
273
+
274
+ Use this method to solve Yandex Smart Captcha. Returns JSON with the token.
275
+ ```python
276
+ result = solver.yandex_smart(sitekey='0x1AAAAh45AAAAkg0s2VIOD34y5hy4h4h',
277
+ url='http://mysite.com/',
278
+ proxy={'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'},
279
+ userAgent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36')
280
+ ```
272
281
 
273
282
  ### Cloudflare Turnstile
274
283
 
@@ -422,7 +431,7 @@ result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320'
422
431
 
423
432
  <sup>[API method description.](https://2captcha.com/2captcha-api#tencent)</sup>
424
433
 
425
- Use this method to solve Cutcaptcha. Returns a token.
434
+ Use this method to solve Tencent captcha. Returns a token.
426
435
  ```python
427
436
  result = solver.tencent(app_id="197326679",
428
437
  url="https://mysite.com/page/with/tencent",
@@ -465,7 +474,7 @@ result = solver.cybersiara(master_url_id='tpjOCKjjpdzv3d8Ub2E9COEWKt1vl1Mv',
465
474
 
466
475
  ### send / get_result
467
476
  These methods can be used for manual captcha submission and answer polling. The `send()` method supports sending any captcha
468
- type, to specify the captcha type you must send value `method` manually, for example `method='hcaptcha'` for solving hCapthca.
477
+ type, to specify the captcha type you must send value `method` manually, for example `method='recaptcha'` for solving reCaptcha.
469
478
  You can find the value of the `method` parameter in the [API documentation](https://2captcha.com/2captcha-api).
470
479
 
471
480
  Example for solving Normal captcha manually:
@@ -477,17 +486,6 @@ import time
477
486
  id = solver.send(file='path/to/captcha.jpg')
478
487
  time.sleep(20)
479
488
 
480
- code = solver.get_result(id)
481
- ```
482
- Example for solving hCaptcha manually:
483
- ```python
484
- import time
485
- . . . . .
486
- id = solver.send(sitekey='41b778e7-8f20-45cc-a804-1f1ebb45c579',
487
- url='https://2captcha.com/demo/hcaptcha?difficulty=easy',
488
- method='hcaptcha')
489
- print(id)
490
- time.sleep(20)
491
489
  code = solver.get_result(id)
492
490
  ```
493
491
 
@@ -533,7 +531,7 @@ except TimeoutException as e:
533
531
 
534
532
  ## Proxies
535
533
 
536
- You can pass your proxy as an additional argument for the following methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha,
534
+ You can pass your proxy as an additional argument for the following methods: recaptcha, funcaptcha, geetest, geetest v4,
537
535
  keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, amazon waf, mtcaptcha, friendly captcha, cutcaptcha, Tencent, DataDome, cybersiara.
538
536
 
539
537
 
@@ -571,7 +569,7 @@ captcha_result = asyncio.run(captchaSolver(image))
571
569
  Examples of solving all supported captcha types are located in the [examples] directory.
572
570
 
573
571
  ## Examples using Selenium
574
- Also we have a [separate repository](https://github.com/2captcha/captcha-solver-selenium-python-examples) you can find examples of captcha solving using [Selenium](https://pypi.org/project/selenium/) library. At the moment we have implemented examples of bypassing [reCAPTCHA](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/reCAPTCHA), [hCaptcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/hCaptcha), [normal captcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/normal_captcha) (image captcha) and [text captcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/text_captcha) using Selenium.
572
+ Also we have a [separate repository](https://github.com/2captcha/captcha-solver-selenium-python-examples) you can find examples of captcha solving using [Selenium](https://pypi.org/project/selenium/) library. At the moment we have implemented examples of bypassing [reCAPTCHA](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/reCAPTCHA), [Cloudflare](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/cloudflare), [Coordinates](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/coordinates), [MTCaptcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/mtcaptcha), [normal captcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/normal_captcha) (image captcha) and [text captcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/text_captcha) using Selenium.
575
573
 
576
574
  ## Useful articles
577
575
 
@@ -26,7 +26,7 @@ Examples of API requests for different captcha types are available on the [Pytho
26
26
  - [FunCaptcha](#funcaptcha)
27
27
  - [GeeTest](#geetest)
28
28
  - [GeeTest v4](#geetest-v4)
29
- - [hCaptcha](#hcaptcha)
29
+ - [Yandex Smart](#yandex-smart)
30
30
  - [Lemin Cropped Captcha](#lemin-cropped-captcha)
31
31
  - [Cloudflare Turnstile](#cloudflare-turnstile)
32
32
  - [Amazon WAF](#amazon-waf)
@@ -41,10 +41,10 @@ Examples of API requests for different captcha types are available on the [Pytho
41
41
  - [Friendly Captcha](#friendly-captcha)
42
42
  - [Cutcaptcha](#cutcaptcha)
43
43
  - [Tencent](#tencent)
44
- - [Datadome](#datadome)
44
+ - [DataDome](#datadome)
45
45
  - [CyberSiARA](#cybersiara)
46
46
  - [Other methods](#other-methods)
47
- - [send / get_result](#send--get_result)
47
+ - [send / get\_result](#send--get_result)
48
48
  - [balance](#balance)
49
49
  - [report](#report)
50
50
  - [Error handling](#error-handling)
@@ -53,10 +53,10 @@ Examples of API requests for different captcha types are available on the [Pytho
53
53
  - [Examples](#examples)
54
54
  - [Examples using Selenium](#examples-using-selenium)
55
55
  - [Useful articles](#useful-articles)
56
- - [Get in touch](#get-in-touch)
57
- - [Join the team 👪](#join-the-team-)
58
- - [License](#license)
59
- - [Graphics and Trademarks](#graphics-and-trademarks)
56
+ - [Get in touch](#get-in-touch)
57
+ - [Join the team 👪](#join-the-team-)
58
+ - [License](#license)
59
+ - [Graphics and Trademarks](#graphics-and-trademarks)
60
60
 
61
61
  ## Installation
62
62
 
@@ -87,6 +87,7 @@ config = {
87
87
  'defaultTimeout': 120,
88
88
  'recaptchaTimeout': 600,
89
89
  'pollingInterval': 10,
90
+ 'extendedResponse': False
90
91
  }
91
92
  solver = TwoCaptcha(**config)
92
93
  ```
@@ -101,6 +102,8 @@ solver = TwoCaptcha(**config)
101
102
  | defaultTimeout | 120 | Polling timeout in seconds for all captcha types except reCAPTCHA. Defines how long the module tries to get the answer from the `res.php` API endpoint |
102
103
  | recaptchaTimeout | 600 | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from the `res.php` API endpoint |
103
104
  | pollingInterval | 10 | Interval in seconds between requests to the `res.php` API endpoint. Setting values less than 5 seconds is not recommended |
105
+ | extendedResponse | None | Set to `True` to get the response with additional fields or in more practical format (enables `JSON` response from `res.php` API endpoint). Suitable for [ClickCaptcha](#clickcaptcha), [Canvas](#canvas) |
106
+
104
107
 
105
108
  > [!IMPORTANT]
106
109
  > Once `callback` is defined for the `TwoCaptcha` instance, all methods return only the captcha ID and DO NOT poll the API to get the result. The result will be sent to the callback URL.
@@ -223,19 +226,6 @@ result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
223
226
  ```
224
227
 
225
228
 
226
- ### hCaptcha
227
-
228
- <sup>[API method description.](https://2captcha.com/2captcha-api#solving_hcaptcha)</sup>
229
-
230
- Use this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.
231
- ```python
232
- result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
233
- url='https://www.site.com/page/',
234
- param1=..., ...)
235
-
236
- ```
237
-
238
-
239
229
  ### Lemin Cropped Captcha
240
230
 
241
231
  <sup>[API method description.](https://2captcha.com/2captcha-api#lemin)</sup>
@@ -249,6 +239,15 @@ result = solver.lemin(captcha_id='CROPPED_1abcd2f_a1234b567c890d12ef3a456bc78d90
249
239
 
250
240
  ```
251
241
 
242
+ ### Yandex Smart
243
+
244
+ Use this method to solve Yandex Smart Captcha. Returns JSON with the token.
245
+ ```python
246
+ result = solver.yandex_smart(sitekey='0x1AAAAh45AAAAkg0s2VIOD34y5hy4h4h',
247
+ url='http://mysite.com/',
248
+ proxy={'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'},
249
+ userAgent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36')
250
+ ```
252
251
 
253
252
  ### Cloudflare Turnstile
254
253
 
@@ -402,7 +401,7 @@ result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320'
402
401
 
403
402
  <sup>[API method description.](https://2captcha.com/2captcha-api#tencent)</sup>
404
403
 
405
- Use this method to solve Cutcaptcha. Returns a token.
404
+ Use this method to solve Tencent captcha. Returns a token.
406
405
  ```python
407
406
  result = solver.tencent(app_id="197326679",
408
407
  url="https://mysite.com/page/with/tencent",
@@ -445,7 +444,7 @@ result = solver.cybersiara(master_url_id='tpjOCKjjpdzv3d8Ub2E9COEWKt1vl1Mv',
445
444
 
446
445
  ### send / get_result
447
446
  These methods can be used for manual captcha submission and answer polling. The `send()` method supports sending any captcha
448
- type, to specify the captcha type you must send value `method` manually, for example `method='hcaptcha'` for solving hCapthca.
447
+ type, to specify the captcha type you must send value `method` manually, for example `method='recaptcha'` for solving reCaptcha.
449
448
  You can find the value of the `method` parameter in the [API documentation](https://2captcha.com/2captcha-api).
450
449
 
451
450
  Example for solving Normal captcha manually:
@@ -457,17 +456,6 @@ import time
457
456
  id = solver.send(file='path/to/captcha.jpg')
458
457
  time.sleep(20)
459
458
 
460
- code = solver.get_result(id)
461
- ```
462
- Example for solving hCaptcha manually:
463
- ```python
464
- import time
465
- . . . . .
466
- id = solver.send(sitekey='41b778e7-8f20-45cc-a804-1f1ebb45c579',
467
- url='https://2captcha.com/demo/hcaptcha?difficulty=easy',
468
- method='hcaptcha')
469
- print(id)
470
- time.sleep(20)
471
459
  code = solver.get_result(id)
472
460
  ```
473
461
 
@@ -513,7 +501,7 @@ except TimeoutException as e:
513
501
 
514
502
  ## Proxies
515
503
 
516
- You can pass your proxy as an additional argument for the following methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha,
504
+ You can pass your proxy as an additional argument for the following methods: recaptcha, funcaptcha, geetest, geetest v4,
517
505
  keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, amazon waf, mtcaptcha, friendly captcha, cutcaptcha, Tencent, DataDome, cybersiara.
518
506
 
519
507
 
@@ -551,7 +539,7 @@ captcha_result = asyncio.run(captchaSolver(image))
551
539
  Examples of solving all supported captcha types are located in the [examples] directory.
552
540
 
553
541
  ## Examples using Selenium
554
- Also we have a [separate repository](https://github.com/2captcha/captcha-solver-selenium-python-examples) you can find examples of captcha solving using [Selenium](https://pypi.org/project/selenium/) library. At the moment we have implemented examples of bypassing [reCAPTCHA](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/reCAPTCHA), [hCaptcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/hCaptcha), [normal captcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/normal_captcha) (image captcha) and [text captcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/text_captcha) using Selenium.
542
+ Also we have a [separate repository](https://github.com/2captcha/captcha-solver-selenium-python-examples) you can find examples of captcha solving using [Selenium](https://pypi.org/project/selenium/) library. At the moment we have implemented examples of bypassing [reCAPTCHA](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/reCAPTCHA), [Cloudflare](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/cloudflare), [Coordinates](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/coordinates), [MTCaptcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/mtcaptcha), [normal captcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/normal_captcha) (image captcha) and [text captcha](https://github.com/2captcha/captcha-solver-selenium-python-examples/tree/main/examples/text_captcha) using Selenium.
555
543
 
556
544
  ## Useful articles
557
545
 
@@ -590,4 +578,4 @@ The graphics and trademarks included in this repository are not covered by the M
590
578
  [Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
591
579
  [Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
592
580
  [examples]: ./examples
593
- [residential proxies]: https://2captcha.com/proxy/residential-proxies
581
+ [residential proxies]: https://2captcha.com/proxy/residential-proxies
@@ -33,7 +33,7 @@ setup(name='2captcha-python',
33
33
  "Intended Audience :: Developers",
34
34
  ],
35
35
  keywords=[
36
- '2captcha', 'captcha', 'api', 'captcha solver', 'reCAPTCHA', 'hCaptcha',
36
+ '2captcha', 'captcha', 'api', 'captcha solver', 'reCAPTCHA',
37
37
  'FunCaptcha', 'Geetest', 'image captcha', 'Coordinates', 'Click Captcha',
38
38
  'Geetest V4', 'Lemin captcha', 'Amazon WAF', 'Cloudflare Turnstile',
39
39
  'Capy Puzzle', 'MTCaptcha', 'Friendly Captcha', 'Tencent', 'Cutcaptcha', 'DataDome', 'cybersiara'],
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import unittest
4
+
5
+ try:
6
+ from .abstract import AbstractTest
7
+ except ImportError:
8
+ from abstract import AbstractTest
9
+
10
+
11
+ class YandexSmartCaptchaTest(AbstractTest):
12
+
13
+ def test_all_params(self):
14
+ params = {
15
+ 'sitekey': 'FEXfAbHQsToo97VidNVk3j4dC74nGW1DgdPpL4O',
16
+ 'url': 'https://www.site.com/page/',
17
+ }
18
+
19
+ sends = {
20
+ 'method': 'yandex',
21
+ 'sitekey': 'FEXfAbHQsToo97VidNVk3j4dC74nGW1DgdPpL4O',
22
+ 'pageurl': 'https://www.site.com/page/',
23
+ }
24
+
25
+ return self.send_return(sends, self.solver.yandex_smart, **params)
26
+
27
+
28
+ if __name__ == '__main__':
29
+ unittest.main()
@@ -3,7 +3,7 @@ from .solver import (TwoCaptcha, SolverExceptions, ValidationException,
3
3
  NetworkException, ApiException, TimeoutException)
4
4
 
5
5
  """
6
- Python 3 package for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, hcaptcha,
6
+ Python 3 package for easy integration with the API of 2captcha captcha solving service to bypass recaptcha,
7
7
  funcaptcha, geetest and solve any other captchas.
8
8
 
9
9
  website 2captcha [https://2captcha.com/]
@@ -12,4 +12,4 @@ support@2captcha.com
12
12
  """
13
13
 
14
14
  __author__ = '2captcha'
15
- __version__ = '1.4.0'
15
+ __version__ = '1.5.1'
@@ -41,7 +41,8 @@ class TwoCaptcha():
41
41
  defaultTimeout=120,
42
42
  recaptchaTimeout=600,
43
43
  pollingInterval=10,
44
- server = '2captcha.com'):
44
+ server = '2captcha.com',
45
+ extendedResponse=None):
45
46
 
46
47
  self.API_KEY = apiKey
47
48
  self.soft_id = softId
@@ -52,6 +53,7 @@ class TwoCaptcha():
52
53
  self.api_client = ApiClient(post_url = str(server))
53
54
  self.max_files = 9
54
55
  self.exceptions = SolverExceptions
56
+ self.extendedResponse = extendedResponse
55
57
 
56
58
  def normal(self, file, **kwargs):
57
59
  '''Wrapper for solving a normal captcha (image).
@@ -854,6 +856,33 @@ class TwoCaptcha():
854
856
  **kwargs)
855
857
  return result
856
858
 
859
+ def yandex_smart(self, sitekey, url, **kwargs):
860
+ '''Wrapper for solving Yandex Smart.
861
+
862
+ Parameters
863
+ __________
864
+ sitekey : str
865
+ The value of data-sitekey attribute of captcha's div element on page.
866
+ url : str
867
+ Full URL of the page where you solve the captcha.
868
+ softId : int, optional
869
+ ID of software developer. Developers who integrated their software with 2Captcha get reward: 10% of
870
+ spendings of their software users.
871
+ callback : str, optional
872
+ URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on
873
+ the server. More info here https://2captcha.com/2captcha-api#pingback.
874
+ proxy : dict, optional
875
+ {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
876
+ userAgent: str, optional
877
+ User-Agent of the browser that will be used by the employee when loading the captcha.
878
+ '''
879
+
880
+ result = self.solve(sitekey=sitekey,
881
+ url=url,
882
+ method='yandex',
883
+ **kwargs)
884
+ return result
885
+
857
886
  def solve(self, timeout=0, polling_interval=0, **kwargs):
858
887
  '''Sends captcha, receives result.
859
888
 
@@ -875,14 +904,23 @@ class TwoCaptcha():
875
904
  result = {'captchaId': id_}
876
905
 
877
906
  if self.callback is None:
878
-
879
907
  timeout = float(timeout or self.default_timeout)
880
908
  sleep = int(polling_interval or self.polling_interval)
881
909
 
882
910
  code = self.wait_result(id_, timeout, sleep)
883
- result.update({'code': code})
884
911
 
885
- return result
912
+ if self.extendedResponse == True:
913
+
914
+ new_code = {
915
+ key if key != 'request' else 'code': value
916
+ for key, value in code.items()
917
+ if key != 'status'
918
+ }
919
+ result.update(new_code)
920
+ else:
921
+ result.update({'code': code})
922
+
923
+ return result
886
924
 
887
925
  def wait_result(self, id_, timeout, polling_interval):
888
926
 
@@ -944,6 +982,7 @@ class TwoCaptcha():
944
982
  return response[3:]
945
983
 
946
984
  def get_result(self, id_):
985
+ import json
947
986
  """This method can be used for manual captcha answer polling.
948
987
 
949
988
  Parameters
@@ -955,15 +994,31 @@ class TwoCaptcha():
955
994
  answer : text
956
995
  """
957
996
 
958
- response = self.api_client.res(key=self.API_KEY, action='get', id=id_)
997
+ if self.extendedResponse == True:
959
998
 
960
- if response == 'CAPCHA_NOT_READY':
961
- raise NetworkException
999
+ response = self.api_client.res(key=self.API_KEY, action='get', id=id_, json=1)
962
1000
 
963
- if not response.startswith('OK|'):
964
- raise ApiException(f'cannot recognize response {response}')
1001
+ response_data = json.loads(response)
965
1002
 
966
- return response[3:]
1003
+ if response_data.get("status") == 0:
1004
+ raise NetworkException
1005
+
1006
+ if not response_data.get("status") == 1:
1007
+ raise ApiException(f'Unexpected status in response: {response_data}')
1008
+
1009
+ return response_data
1010
+
1011
+ else:
1012
+
1013
+ response = self.api_client.res(key=self.API_KEY, action='get', id=id_)
1014
+
1015
+ if response == 'CAPCHA_NOT_READY':
1016
+ raise NetworkException
1017
+
1018
+ if not response.startswith('OK|'):
1019
+ raise ApiException(f'cannot recognize response {response}')
1020
+
1021
+ return response[3:]
967
1022
 
968
1023
  def balance(self):
969
1024
  '''Get my balance
File without changes