2captcha-python 1.3.0__tar.gz → 1.5.0__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.
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/2captcha_python.egg-info/PKG-INFO +24 -8
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/2captcha_python.egg-info/SOURCES.txt +1 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/PKG-INFO +24 -8
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/README.md +22 -6
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/setup.py +1 -1
- 2captcha_python-1.5.0/tests/test_cybersiara.py +32 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/twocaptcha/__init__.py +1 -1
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/twocaptcha/solver.py +58 -10
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/2captcha_python.egg-info/dependency_links.txt +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/2captcha_python.egg-info/requires.txt +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/2captcha_python.egg-info/top_level.txt +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/LICENSE +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/setup.cfg +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_amazon_waf.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_atb_captcha.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_canvas.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_capy.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_coordinates.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_cutcaptcha.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_datadome.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_friendly_captcha.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_funcaptcha.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_geetest.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_geetest_v4.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_grid.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_hcaptcha.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_keycaptcha.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_lemin.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_mtcaptcha.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_normal.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_recaptcha.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_rotate.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_tencent.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_text.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/tests/test_turnstile.py +0 -0
- {2captcha_python-1.3.0 → 2captcha_python-1.5.0}/twocaptcha/api.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: 2captcha-python
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
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
|
|
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
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
@@ -62,8 +62,9 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
62
62
|
- [Cutcaptcha](#cutcaptcha)
|
|
63
63
|
- [Tencent](#tencent)
|
|
64
64
|
- [Datadome](#datadome)
|
|
65
|
+
- [CyberSiARA](#cybersiara)
|
|
65
66
|
- [Other methods](#other-methods)
|
|
66
|
-
- [send /
|
|
67
|
+
- [send / get\_result](#send--get_result)
|
|
67
68
|
- [balance](#balance)
|
|
68
69
|
- [report](#report)
|
|
69
70
|
- [Error handling](#error-handling)
|
|
@@ -72,10 +73,10 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
72
73
|
- [Examples](#examples)
|
|
73
74
|
- [Examples using Selenium](#examples-using-selenium)
|
|
74
75
|
- [Useful articles](#useful-articles)
|
|
75
|
-
- [Get in touch](#get-in-touch)
|
|
76
|
-
- [Join the team 👪](#join-the-team-)
|
|
77
|
-
- [License](#license)
|
|
78
|
-
|
|
76
|
+
- [Get in touch](#get-in-touch)
|
|
77
|
+
- [Join the team 👪](#join-the-team-)
|
|
78
|
+
- [License](#license)
|
|
79
|
+
- [Graphics and Trademarks](#graphics-and-trademarks)
|
|
79
80
|
|
|
80
81
|
## Installation
|
|
81
82
|
|
|
@@ -120,6 +121,8 @@ solver = TwoCaptcha(**config)
|
|
|
120
121
|
| 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 |
|
|
121
122
|
| recaptchaTimeout | 600 | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from the `res.php` API endpoint |
|
|
122
123
|
| pollingInterval | 10 | Interval in seconds between requests to the `res.php` API endpoint. Setting values less than 5 seconds is not recommended |
|
|
124
|
+
| 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 [hCaptcha](#hcaptcha), [ClickCaptcha](#clickcaptcha), [Canvas](#canvas) |
|
|
125
|
+
|
|
123
126
|
|
|
124
127
|
> [!IMPORTANT]
|
|
125
128
|
> 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.
|
|
@@ -448,6 +451,18 @@ result = solver.datadome(captcha_url="https://geo.captcha-delivery.com/captcha/?
|
|
|
448
451
|
param1=..., ...)
|
|
449
452
|
```
|
|
450
453
|
|
|
454
|
+
### CyberSiARA
|
|
455
|
+
|
|
456
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#cybersiara)</sup>
|
|
457
|
+
|
|
458
|
+
Use this method to solve CyberSiARA. Returns a token.
|
|
459
|
+
```python
|
|
460
|
+
result = solver.cybersiara(master_url_id='tpjOCKjjpdzv3d8Ub2E9COEWKt1vl1Mv',
|
|
461
|
+
pageurl='https://demo.mycybersiara.com/',
|
|
462
|
+
userAgent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',
|
|
463
|
+
param1=..., ...)
|
|
464
|
+
```
|
|
465
|
+
|
|
451
466
|
## Other methods
|
|
452
467
|
|
|
453
468
|
### send / get_result
|
|
@@ -521,7 +536,8 @@ except TimeoutException as e:
|
|
|
521
536
|
## Proxies
|
|
522
537
|
|
|
523
538
|
You can pass your proxy as an additional argument for the following methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha,
|
|
524
|
-
keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, amazon waf, mtcaptcha, friendly captcha, cutcaptcha, Tencent, DataDome.
|
|
539
|
+
keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, amazon waf, mtcaptcha, friendly captcha, cutcaptcha, Tencent, DataDome, cybersiara.
|
|
540
|
+
|
|
525
541
|
|
|
526
542
|
The proxy will be forwarded to the API to solve the captcha.
|
|
527
543
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: 2captcha-python
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
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
|
|
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
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
@@ -62,8 +62,9 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
62
62
|
- [Cutcaptcha](#cutcaptcha)
|
|
63
63
|
- [Tencent](#tencent)
|
|
64
64
|
- [Datadome](#datadome)
|
|
65
|
+
- [CyberSiARA](#cybersiara)
|
|
65
66
|
- [Other methods](#other-methods)
|
|
66
|
-
- [send /
|
|
67
|
+
- [send / get\_result](#send--get_result)
|
|
67
68
|
- [balance](#balance)
|
|
68
69
|
- [report](#report)
|
|
69
70
|
- [Error handling](#error-handling)
|
|
@@ -72,10 +73,10 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
72
73
|
- [Examples](#examples)
|
|
73
74
|
- [Examples using Selenium](#examples-using-selenium)
|
|
74
75
|
- [Useful articles](#useful-articles)
|
|
75
|
-
- [Get in touch](#get-in-touch)
|
|
76
|
-
- [Join the team 👪](#join-the-team-)
|
|
77
|
-
- [License](#license)
|
|
78
|
-
|
|
76
|
+
- [Get in touch](#get-in-touch)
|
|
77
|
+
- [Join the team 👪](#join-the-team-)
|
|
78
|
+
- [License](#license)
|
|
79
|
+
- [Graphics and Trademarks](#graphics-and-trademarks)
|
|
79
80
|
|
|
80
81
|
## Installation
|
|
81
82
|
|
|
@@ -120,6 +121,8 @@ solver = TwoCaptcha(**config)
|
|
|
120
121
|
| 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 |
|
|
121
122
|
| recaptchaTimeout | 600 | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from the `res.php` API endpoint |
|
|
122
123
|
| pollingInterval | 10 | Interval in seconds between requests to the `res.php` API endpoint. Setting values less than 5 seconds is not recommended |
|
|
124
|
+
| 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 [hCaptcha](#hcaptcha), [ClickCaptcha](#clickcaptcha), [Canvas](#canvas) |
|
|
125
|
+
|
|
123
126
|
|
|
124
127
|
> [!IMPORTANT]
|
|
125
128
|
> 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.
|
|
@@ -448,6 +451,18 @@ result = solver.datadome(captcha_url="https://geo.captcha-delivery.com/captcha/?
|
|
|
448
451
|
param1=..., ...)
|
|
449
452
|
```
|
|
450
453
|
|
|
454
|
+
### CyberSiARA
|
|
455
|
+
|
|
456
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#cybersiara)</sup>
|
|
457
|
+
|
|
458
|
+
Use this method to solve CyberSiARA. Returns a token.
|
|
459
|
+
```python
|
|
460
|
+
result = solver.cybersiara(master_url_id='tpjOCKjjpdzv3d8Ub2E9COEWKt1vl1Mv',
|
|
461
|
+
pageurl='https://demo.mycybersiara.com/',
|
|
462
|
+
userAgent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',
|
|
463
|
+
param1=..., ...)
|
|
464
|
+
```
|
|
465
|
+
|
|
451
466
|
## Other methods
|
|
452
467
|
|
|
453
468
|
### send / get_result
|
|
@@ -521,7 +536,8 @@ except TimeoutException as e:
|
|
|
521
536
|
## Proxies
|
|
522
537
|
|
|
523
538
|
You can pass your proxy as an additional argument for the following methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha,
|
|
524
|
-
keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, amazon waf, mtcaptcha, friendly captcha, cutcaptcha, Tencent, DataDome.
|
|
539
|
+
keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, amazon waf, mtcaptcha, friendly captcha, cutcaptcha, Tencent, DataDome, cybersiara.
|
|
540
|
+
|
|
525
541
|
|
|
526
542
|
The proxy will be forwarded to the API to solve the captcha.
|
|
527
543
|
|
|
@@ -42,8 +42,9 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
42
42
|
- [Cutcaptcha](#cutcaptcha)
|
|
43
43
|
- [Tencent](#tencent)
|
|
44
44
|
- [Datadome](#datadome)
|
|
45
|
+
- [CyberSiARA](#cybersiara)
|
|
45
46
|
- [Other methods](#other-methods)
|
|
46
|
-
- [send /
|
|
47
|
+
- [send / get\_result](#send--get_result)
|
|
47
48
|
- [balance](#balance)
|
|
48
49
|
- [report](#report)
|
|
49
50
|
- [Error handling](#error-handling)
|
|
@@ -52,10 +53,10 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
52
53
|
- [Examples](#examples)
|
|
53
54
|
- [Examples using Selenium](#examples-using-selenium)
|
|
54
55
|
- [Useful articles](#useful-articles)
|
|
55
|
-
- [Get in touch](#get-in-touch)
|
|
56
|
-
- [Join the team 👪](#join-the-team-)
|
|
57
|
-
- [License](#license)
|
|
58
|
-
|
|
56
|
+
- [Get in touch](#get-in-touch)
|
|
57
|
+
- [Join the team 👪](#join-the-team-)
|
|
58
|
+
- [License](#license)
|
|
59
|
+
- [Graphics and Trademarks](#graphics-and-trademarks)
|
|
59
60
|
|
|
60
61
|
## Installation
|
|
61
62
|
|
|
@@ -100,6 +101,8 @@ solver = TwoCaptcha(**config)
|
|
|
100
101
|
| 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 |
|
|
101
102
|
| recaptchaTimeout | 600 | Polling timeout for reCAPTCHA in seconds. Defines how long the module tries to get the answer from the `res.php` API endpoint |
|
|
102
103
|
| pollingInterval | 10 | Interval in seconds between requests to the `res.php` API endpoint. Setting values less than 5 seconds is not recommended |
|
|
104
|
+
| 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 [hCaptcha](#hcaptcha), [ClickCaptcha](#clickcaptcha), [Canvas](#canvas) |
|
|
105
|
+
|
|
103
106
|
|
|
104
107
|
> [!IMPORTANT]
|
|
105
108
|
> 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.
|
|
@@ -428,6 +431,18 @@ result = solver.datadome(captcha_url="https://geo.captcha-delivery.com/captcha/?
|
|
|
428
431
|
param1=..., ...)
|
|
429
432
|
```
|
|
430
433
|
|
|
434
|
+
### CyberSiARA
|
|
435
|
+
|
|
436
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#cybersiara)</sup>
|
|
437
|
+
|
|
438
|
+
Use this method to solve CyberSiARA. Returns a token.
|
|
439
|
+
```python
|
|
440
|
+
result = solver.cybersiara(master_url_id='tpjOCKjjpdzv3d8Ub2E9COEWKt1vl1Mv',
|
|
441
|
+
pageurl='https://demo.mycybersiara.com/',
|
|
442
|
+
userAgent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',
|
|
443
|
+
param1=..., ...)
|
|
444
|
+
```
|
|
445
|
+
|
|
431
446
|
## Other methods
|
|
432
447
|
|
|
433
448
|
### send / get_result
|
|
@@ -501,7 +516,8 @@ except TimeoutException as e:
|
|
|
501
516
|
## Proxies
|
|
502
517
|
|
|
503
518
|
You can pass your proxy as an additional argument for the following methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha,
|
|
504
|
-
keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, amazon waf, mtcaptcha, friendly captcha, cutcaptcha, Tencent, DataDome.
|
|
519
|
+
keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, amazon waf, mtcaptcha, friendly captcha, cutcaptcha, Tencent, DataDome, cybersiara.
|
|
520
|
+
|
|
505
521
|
|
|
506
522
|
The proxy will be forwarded to the API to solve the captcha.
|
|
507
523
|
|
|
@@ -36,6 +36,6 @@ setup(name='2captcha-python',
|
|
|
36
36
|
'2captcha', 'captcha', 'api', 'captcha solver', 'reCAPTCHA', 'hCaptcha',
|
|
37
37
|
'FunCaptcha', 'Geetest', 'image captcha', 'Coordinates', 'Click Captcha',
|
|
38
38
|
'Geetest V4', 'Lemin captcha', 'Amazon WAF', 'Cloudflare Turnstile',
|
|
39
|
-
'Capy Puzzle', 'MTCaptcha', 'Friendly Captcha', 'Tencent', 'Cutcaptcha', 'DataDome'],
|
|
39
|
+
'Capy Puzzle', 'MTCaptcha', 'Friendly Captcha', 'Tencent', 'Cutcaptcha', 'DataDome', 'cybersiara'],
|
|
40
40
|
python_requires='>=3.6',
|
|
41
41
|
test_suite='tests')
|
|
@@ -0,0 +1,32 @@
|
|
|
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 CybersiaraTest(AbstractTest):
|
|
12
|
+
|
|
13
|
+
def test_all_params(self):
|
|
14
|
+
params = {
|
|
15
|
+
'master_url_id': 'tpjOCKjjpdzv3d8Ub2E9COEWKt1vl1Mv',
|
|
16
|
+
'pageurl': 'https://demo.mycybersiara.com/',
|
|
17
|
+
'userAgent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
sends = {
|
|
21
|
+
'method': 'cybersiara',
|
|
22
|
+
'master_url_id': 'tpjOCKjjpdzv3d8Ub2E9COEWKt1vl1Mv',
|
|
23
|
+
'pageurl': 'https://demo.mycybersiara.com/',
|
|
24
|
+
'userAgent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return self.send_return(sends, self.solver.cybersiara, **params)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
if __name__ == '__main__':
|
|
31
|
+
unittest.main()
|
|
32
|
+
|
|
@@ -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).
|
|
@@ -831,7 +833,27 @@ class TwoCaptcha():
|
|
|
831
833
|
userAgent=userAgent,
|
|
832
834
|
proxy=proxy,
|
|
833
835
|
**kwargs)
|
|
836
|
+
return result
|
|
837
|
+
|
|
838
|
+
def cybersiara(self, master_url_id, pageurl, userAgent, **kwargs):
|
|
839
|
+
'''Wrapper for solving CyberSiARA captcha.
|
|
834
840
|
|
|
841
|
+
Parameters
|
|
842
|
+
__________
|
|
843
|
+
master_url_id : str
|
|
844
|
+
The value of the MasterUrlId parameter from the request to API/CyberSiara/GetCyberSiara.
|
|
845
|
+
pageurl : str
|
|
846
|
+
Full URL of the page with captcha.
|
|
847
|
+
userAgent : str
|
|
848
|
+
User-Agent of your browser.
|
|
849
|
+
proxy : dict, optional
|
|
850
|
+
{'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'}.
|
|
851
|
+
'''
|
|
852
|
+
result = self.solve(method='cybersiara',
|
|
853
|
+
master_url_id=master_url_id,
|
|
854
|
+
pageurl=pageurl,
|
|
855
|
+
userAgent=userAgent,
|
|
856
|
+
**kwargs)
|
|
835
857
|
return result
|
|
836
858
|
|
|
837
859
|
def solve(self, timeout=0, polling_interval=0, **kwargs):
|
|
@@ -855,14 +877,23 @@ class TwoCaptcha():
|
|
|
855
877
|
result = {'captchaId': id_}
|
|
856
878
|
|
|
857
879
|
if self.callback is None:
|
|
858
|
-
|
|
859
880
|
timeout = float(timeout or self.default_timeout)
|
|
860
881
|
sleep = int(polling_interval or self.polling_interval)
|
|
861
882
|
|
|
862
883
|
code = self.wait_result(id_, timeout, sleep)
|
|
863
|
-
result.update({'code': code})
|
|
864
884
|
|
|
865
|
-
|
|
885
|
+
if self.extendedResponse == True:
|
|
886
|
+
|
|
887
|
+
new_code = {
|
|
888
|
+
key if key != 'request' else 'code': value
|
|
889
|
+
for key, value in code.items()
|
|
890
|
+
if key != 'status'
|
|
891
|
+
}
|
|
892
|
+
result.update(new_code)
|
|
893
|
+
else:
|
|
894
|
+
result.update({'code': code})
|
|
895
|
+
|
|
896
|
+
return result
|
|
866
897
|
|
|
867
898
|
def wait_result(self, id_, timeout, polling_interval):
|
|
868
899
|
|
|
@@ -924,6 +955,7 @@ class TwoCaptcha():
|
|
|
924
955
|
return response[3:]
|
|
925
956
|
|
|
926
957
|
def get_result(self, id_):
|
|
958
|
+
import json
|
|
927
959
|
"""This method can be used for manual captcha answer polling.
|
|
928
960
|
|
|
929
961
|
Parameters
|
|
@@ -935,15 +967,31 @@ class TwoCaptcha():
|
|
|
935
967
|
answer : text
|
|
936
968
|
"""
|
|
937
969
|
|
|
938
|
-
|
|
970
|
+
if self.extendedResponse == True:
|
|
939
971
|
|
|
940
|
-
|
|
941
|
-
raise NetworkException
|
|
972
|
+
response = self.api_client.res(key=self.API_KEY, action='get', id=id_, json=1)
|
|
942
973
|
|
|
943
|
-
|
|
944
|
-
raise ApiException(f'cannot recognize response {response}')
|
|
974
|
+
response_data = json.loads(response)
|
|
945
975
|
|
|
946
|
-
|
|
976
|
+
if response_data.get("status") == 0:
|
|
977
|
+
raise NetworkException
|
|
978
|
+
|
|
979
|
+
if not response_data.get("status") == 1:
|
|
980
|
+
raise ApiException(f'Unexpected status in response: {response_data}')
|
|
981
|
+
|
|
982
|
+
return response_data
|
|
983
|
+
|
|
984
|
+
else:
|
|
985
|
+
|
|
986
|
+
response = self.api_client.res(key=self.API_KEY, action='get', id=id_)
|
|
987
|
+
|
|
988
|
+
if response == 'CAPCHA_NOT_READY':
|
|
989
|
+
raise NetworkException
|
|
990
|
+
|
|
991
|
+
if not response.startswith('OK|'):
|
|
992
|
+
raise ApiException(f'cannot recognize response {response}')
|
|
993
|
+
|
|
994
|
+
return response[3:]
|
|
947
995
|
|
|
948
996
|
def balance(self):
|
|
949
997
|
'''Get my balance
|
{2captcha_python-1.3.0 → 2captcha_python-1.5.0}/2captcha_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|