2captcha-python 1.4.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.4.0 → 2captcha_python-1.5.0}/2captcha_python.egg-info/PKG-INFO +8 -6
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/PKG-INFO +8 -6
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/README.md +7 -5
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/twocaptcha/__init__.py +1 -1
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/twocaptcha/solver.py +38 -10
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/2captcha_python.egg-info/SOURCES.txt +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/2captcha_python.egg-info/dependency_links.txt +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/2captcha_python.egg-info/requires.txt +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/2captcha_python.egg-info/top_level.txt +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/LICENSE +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/setup.cfg +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/setup.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_amazon_waf.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_atb_captcha.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_canvas.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_capy.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_coordinates.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_cutcaptcha.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_cybersiara.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_datadome.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_friendly_captcha.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_funcaptcha.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_geetest.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_geetest_v4.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_grid.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_hcaptcha.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_keycaptcha.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_lemin.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_mtcaptcha.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_normal.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_recaptcha.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_rotate.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_tencent.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_text.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/tests/test_turnstile.py +0 -0
- {2captcha_python-1.4.0 → 2captcha_python-1.5.0}/twocaptcha/api.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
@@ -64,7 +64,7 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
64
64
|
- [Datadome](#datadome)
|
|
65
65
|
- [CyberSiARA](#cybersiara)
|
|
66
66
|
- [Other methods](#other-methods)
|
|
67
|
-
- [send /
|
|
67
|
+
- [send / get\_result](#send--get_result)
|
|
68
68
|
- [balance](#balance)
|
|
69
69
|
- [report](#report)
|
|
70
70
|
- [Error handling](#error-handling)
|
|
@@ -73,10 +73,10 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
73
73
|
- [Examples](#examples)
|
|
74
74
|
- [Examples using Selenium](#examples-using-selenium)
|
|
75
75
|
- [Useful articles](#useful-articles)
|
|
76
|
-
- [Get in touch](#get-in-touch)
|
|
77
|
-
- [Join the team 👪](#join-the-team-)
|
|
78
|
-
- [License](#license)
|
|
79
|
-
|
|
76
|
+
- [Get in touch](#get-in-touch)
|
|
77
|
+
- [Join the team 👪](#join-the-team-)
|
|
78
|
+
- [License](#license)
|
|
79
|
+
- [Graphics and Trademarks](#graphics-and-trademarks)
|
|
80
80
|
|
|
81
81
|
## Installation
|
|
82
82
|
|
|
@@ -121,6 +121,8 @@ solver = TwoCaptcha(**config)
|
|
|
121
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 |
|
|
122
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 |
|
|
123
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
|
+
|
|
124
126
|
|
|
125
127
|
> [!IMPORTANT]
|
|
126
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.
|
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
@@ -64,7 +64,7 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
64
64
|
- [Datadome](#datadome)
|
|
65
65
|
- [CyberSiARA](#cybersiara)
|
|
66
66
|
- [Other methods](#other-methods)
|
|
67
|
-
- [send /
|
|
67
|
+
- [send / get\_result](#send--get_result)
|
|
68
68
|
- [balance](#balance)
|
|
69
69
|
- [report](#report)
|
|
70
70
|
- [Error handling](#error-handling)
|
|
@@ -73,10 +73,10 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
73
73
|
- [Examples](#examples)
|
|
74
74
|
- [Examples using Selenium](#examples-using-selenium)
|
|
75
75
|
- [Useful articles](#useful-articles)
|
|
76
|
-
- [Get in touch](#get-in-touch)
|
|
77
|
-
- [Join the team 👪](#join-the-team-)
|
|
78
|
-
- [License](#license)
|
|
79
|
-
|
|
76
|
+
- [Get in touch](#get-in-touch)
|
|
77
|
+
- [Join the team 👪](#join-the-team-)
|
|
78
|
+
- [License](#license)
|
|
79
|
+
- [Graphics and Trademarks](#graphics-and-trademarks)
|
|
80
80
|
|
|
81
81
|
## Installation
|
|
82
82
|
|
|
@@ -121,6 +121,8 @@ solver = TwoCaptcha(**config)
|
|
|
121
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 |
|
|
122
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 |
|
|
123
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
|
+
|
|
124
126
|
|
|
125
127
|
> [!IMPORTANT]
|
|
126
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.
|
|
@@ -44,7 +44,7 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
44
44
|
- [Datadome](#datadome)
|
|
45
45
|
- [CyberSiARA](#cybersiara)
|
|
46
46
|
- [Other methods](#other-methods)
|
|
47
|
-
- [send /
|
|
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
|
-
|
|
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
|
|
|
@@ -101,6 +101,8 @@ solver = TwoCaptcha(**config)
|
|
|
101
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 |
|
|
102
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 |
|
|
103
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
|
+
|
|
104
106
|
|
|
105
107
|
> [!IMPORTANT]
|
|
106
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.
|
|
@@ -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).
|
|
@@ -875,14 +877,23 @@ class TwoCaptcha():
|
|
|
875
877
|
result = {'captchaId': id_}
|
|
876
878
|
|
|
877
879
|
if self.callback is None:
|
|
878
|
-
|
|
879
880
|
timeout = float(timeout or self.default_timeout)
|
|
880
881
|
sleep = int(polling_interval or self.polling_interval)
|
|
881
882
|
|
|
882
883
|
code = self.wait_result(id_, timeout, sleep)
|
|
883
|
-
result.update({'code': code})
|
|
884
884
|
|
|
885
|
-
|
|
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
|
|
886
897
|
|
|
887
898
|
def wait_result(self, id_, timeout, polling_interval):
|
|
888
899
|
|
|
@@ -944,6 +955,7 @@ class TwoCaptcha():
|
|
|
944
955
|
return response[3:]
|
|
945
956
|
|
|
946
957
|
def get_result(self, id_):
|
|
958
|
+
import json
|
|
947
959
|
"""This method can be used for manual captcha answer polling.
|
|
948
960
|
|
|
949
961
|
Parameters
|
|
@@ -955,15 +967,31 @@ class TwoCaptcha():
|
|
|
955
967
|
answer : text
|
|
956
968
|
"""
|
|
957
969
|
|
|
958
|
-
|
|
970
|
+
if self.extendedResponse == True:
|
|
959
971
|
|
|
960
|
-
|
|
961
|
-
raise NetworkException
|
|
972
|
+
response = self.api_client.res(key=self.API_KEY, action='get', id=id_, json=1)
|
|
962
973
|
|
|
963
|
-
|
|
964
|
-
raise ApiException(f'cannot recognize response {response}')
|
|
974
|
+
response_data = json.loads(response)
|
|
965
975
|
|
|
966
|
-
|
|
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:]
|
|
967
995
|
|
|
968
996
|
def balance(self):
|
|
969
997
|
'''Get my balance
|
|
File without changes
|
{2captcha_python-1.4.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
|
|
File without changes
|
|
File without changes
|