2captcha-python 1.2.1__tar.gz → 1.2.3__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.2.1 → 2captcha-python-1.2.3}/2captcha_python.egg-info/PKG-INFO +46 -3
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/2captcha_python.egg-info/SOURCES.txt +3 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/PKG-INFO +46 -3
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/README.md +44 -2
- 2captcha-python-1.2.3/tests/test_cutcaptcha.py +31 -0
- 2captcha-python-1.2.3/tests/test_friendly_captcha.py +29 -0
- 2captcha-python-1.2.3/tests/test_mtcaptcha.py +29 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/twocaptcha/__init__.py +1 -1
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/twocaptcha/solver.py +94 -1
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/2captcha_python.egg-info/dependency_links.txt +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/2captcha_python.egg-info/requires.txt +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/2captcha_python.egg-info/top_level.txt +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/LICENSE +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/setup.cfg +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/setup.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_amazon_waf.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_canvas.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_capy.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_coordinates.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_funcaptcha.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_geetest.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_geetest_v4.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_grid.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_hcaptcha.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_keycaptcha.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_lemin.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_normal.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_recaptcha.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_rotate.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_text.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/tests/test_turnstile.py +0 -0
- {2captcha-python-1.2.1 → 2captcha-python-1.2.3}/twocaptcha/api.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: 2captcha-python
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.3
|
|
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
|
|
@@ -11,6 +11,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Requires-Python: >=3.6
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
|
+
Requires-Dist: requests
|
|
14
15
|
|
|
15
16
|
# Python Module for 2Captcha API
|
|
16
17
|
The easiest way to quickly integrate [2Captcha] captcha solving service into your code to automate solving of any types of captcha.
|
|
@@ -22,6 +23,7 @@ The easiest way to quickly integrate [2Captcha] captcha solving service into you
|
|
|
22
23
|
- [Solve captcha](#solve-captcha)
|
|
23
24
|
- [Captcha options](#captcha-options)
|
|
24
25
|
- [Normal Captcha](#normal-captcha)
|
|
26
|
+
- [Audio Captcha](#audio-captcha)
|
|
25
27
|
- [Text Captcha](#text-captcha)
|
|
26
28
|
- [ReCaptcha v2](#recaptcha-v2)
|
|
27
29
|
- [ReCaptcha v3](#recaptcha-v3)
|
|
@@ -38,6 +40,9 @@ The easiest way to quickly integrate [2Captcha] captcha solving service into you
|
|
|
38
40
|
- [Canvas](#canvas)
|
|
39
41
|
- [ClickCaptcha](#clickcaptcha)
|
|
40
42
|
- [Rotate](#rotate)
|
|
43
|
+
- [MTCaptcha](#mtcaptcha)
|
|
44
|
+
- [Friendly Captcha](#friendly_captcha)
|
|
45
|
+
- [Cutcaptcha](#cutcaptcha)
|
|
41
46
|
- [Other methods](#other-methods)
|
|
42
47
|
- [send / getResult](#send--getresult)
|
|
43
48
|
- [balance](#balance)
|
|
@@ -117,6 +122,16 @@ result = solver.normal('path/to/captcha.jpg', param1=..., ...)
|
|
|
117
122
|
result = solver.normal('https://site-with-captcha.com/path/to/captcha.jpg', param1=..., ...)
|
|
118
123
|
```
|
|
119
124
|
|
|
125
|
+
### Audio Captcha
|
|
126
|
+
To bypass an audio captcha (mp3 formats only) use the following method.
|
|
127
|
+
You must provife the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt".
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
result = solver.audio('path/to/captcha.mp3', lang = 'lang', param1=..., ...)
|
|
131
|
+
# OR
|
|
132
|
+
result = solver.audio('https://site-with-captcha.com/path/to/captcha.mp3', lang = 'lang', param1=..., ...)
|
|
133
|
+
```
|
|
134
|
+
|
|
120
135
|
### Text Captcha
|
|
121
136
|
This method can be used to bypass a captcha that requires to answer a question provided in clear text.
|
|
122
137
|
```python
|
|
@@ -196,8 +211,10 @@ Use this method to solve Cloudflare Turnstile. Returns JSON with the token.
|
|
|
196
211
|
```python
|
|
197
212
|
result = solver.turnstile(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
|
|
198
213
|
url='http://mysite.com/',
|
|
199
|
-
|
|
200
|
-
|
|
214
|
+
data='foo',
|
|
215
|
+
pagedata='bar',
|
|
216
|
+
action='challenge',
|
|
217
|
+
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')
|
|
201
218
|
```
|
|
202
219
|
|
|
203
220
|
### Amazon WAF
|
|
@@ -254,6 +271,32 @@ This method can be used to solve a captcha that asks to rotate an object. Mostly
|
|
|
254
271
|
result = solver.rotate('path/to/captcha.jpg', param1=..., ...)
|
|
255
272
|
```
|
|
256
273
|
|
|
274
|
+
### MTCaptcha
|
|
275
|
+
Use this method to solve MTCaptcha and obtain a token to bypass the protection.
|
|
276
|
+
```python
|
|
277
|
+
result = solver.mtcaptcha(sitekey='MTPublic-KzqLY1cKH',
|
|
278
|
+
url='https://2captcha.com/demo/mtcaptcha',
|
|
279
|
+
param1=..., ...)
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Friendly Captcha
|
|
283
|
+
Friendly Captcha solving method. Returns a token.
|
|
284
|
+
```python
|
|
285
|
+
result = solver.friendly_captcha(sitekey='FCMGEMUD2KTDSQ5H',
|
|
286
|
+
url='https://friendlycaptcha.com/demo',
|
|
287
|
+
param1=..., ...)
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Cutcaptcha
|
|
291
|
+
Use this method to solve Cutcaptcha. Returns the response in JSON.
|
|
292
|
+
```python
|
|
293
|
+
result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320',
|
|
294
|
+
apikey='SAs61IAI',
|
|
295
|
+
url='https://mysite.com/page/with/cutcaptcha',
|
|
296
|
+
param1=..., ...)
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
|
|
257
300
|
## Other methods
|
|
258
301
|
|
|
259
302
|
### send / getResult
|
|
@@ -10,6 +10,8 @@ tests/test_amazon_waf.py
|
|
|
10
10
|
tests/test_canvas.py
|
|
11
11
|
tests/test_capy.py
|
|
12
12
|
tests/test_coordinates.py
|
|
13
|
+
tests/test_cutcaptcha.py
|
|
14
|
+
tests/test_friendly_captcha.py
|
|
13
15
|
tests/test_funcaptcha.py
|
|
14
16
|
tests/test_geetest.py
|
|
15
17
|
tests/test_geetest_v4.py
|
|
@@ -17,6 +19,7 @@ tests/test_grid.py
|
|
|
17
19
|
tests/test_hcaptcha.py
|
|
18
20
|
tests/test_keycaptcha.py
|
|
19
21
|
tests/test_lemin.py
|
|
22
|
+
tests/test_mtcaptcha.py
|
|
20
23
|
tests/test_normal.py
|
|
21
24
|
tests/test_recaptcha.py
|
|
22
25
|
tests/test_rotate.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: 2captcha-python
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.3
|
|
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
|
|
@@ -11,6 +11,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Requires-Python: >=3.6
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
|
+
Requires-Dist: requests
|
|
14
15
|
|
|
15
16
|
# Python Module for 2Captcha API
|
|
16
17
|
The easiest way to quickly integrate [2Captcha] captcha solving service into your code to automate solving of any types of captcha.
|
|
@@ -22,6 +23,7 @@ The easiest way to quickly integrate [2Captcha] captcha solving service into you
|
|
|
22
23
|
- [Solve captcha](#solve-captcha)
|
|
23
24
|
- [Captcha options](#captcha-options)
|
|
24
25
|
- [Normal Captcha](#normal-captcha)
|
|
26
|
+
- [Audio Captcha](#audio-captcha)
|
|
25
27
|
- [Text Captcha](#text-captcha)
|
|
26
28
|
- [ReCaptcha v2](#recaptcha-v2)
|
|
27
29
|
- [ReCaptcha v3](#recaptcha-v3)
|
|
@@ -38,6 +40,9 @@ The easiest way to quickly integrate [2Captcha] captcha solving service into you
|
|
|
38
40
|
- [Canvas](#canvas)
|
|
39
41
|
- [ClickCaptcha](#clickcaptcha)
|
|
40
42
|
- [Rotate](#rotate)
|
|
43
|
+
- [MTCaptcha](#mtcaptcha)
|
|
44
|
+
- [Friendly Captcha](#friendly_captcha)
|
|
45
|
+
- [Cutcaptcha](#cutcaptcha)
|
|
41
46
|
- [Other methods](#other-methods)
|
|
42
47
|
- [send / getResult](#send--getresult)
|
|
43
48
|
- [balance](#balance)
|
|
@@ -117,6 +122,16 @@ result = solver.normal('path/to/captcha.jpg', param1=..., ...)
|
|
|
117
122
|
result = solver.normal('https://site-with-captcha.com/path/to/captcha.jpg', param1=..., ...)
|
|
118
123
|
```
|
|
119
124
|
|
|
125
|
+
### Audio Captcha
|
|
126
|
+
To bypass an audio captcha (mp3 formats only) use the following method.
|
|
127
|
+
You must provife the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt".
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
result = solver.audio('path/to/captcha.mp3', lang = 'lang', param1=..., ...)
|
|
131
|
+
# OR
|
|
132
|
+
result = solver.audio('https://site-with-captcha.com/path/to/captcha.mp3', lang = 'lang', param1=..., ...)
|
|
133
|
+
```
|
|
134
|
+
|
|
120
135
|
### Text Captcha
|
|
121
136
|
This method can be used to bypass a captcha that requires to answer a question provided in clear text.
|
|
122
137
|
```python
|
|
@@ -196,8 +211,10 @@ Use this method to solve Cloudflare Turnstile. Returns JSON with the token.
|
|
|
196
211
|
```python
|
|
197
212
|
result = solver.turnstile(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
|
|
198
213
|
url='http://mysite.com/',
|
|
199
|
-
|
|
200
|
-
|
|
214
|
+
data='foo',
|
|
215
|
+
pagedata='bar',
|
|
216
|
+
action='challenge',
|
|
217
|
+
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')
|
|
201
218
|
```
|
|
202
219
|
|
|
203
220
|
### Amazon WAF
|
|
@@ -254,6 +271,32 @@ This method can be used to solve a captcha that asks to rotate an object. Mostly
|
|
|
254
271
|
result = solver.rotate('path/to/captcha.jpg', param1=..., ...)
|
|
255
272
|
```
|
|
256
273
|
|
|
274
|
+
### MTCaptcha
|
|
275
|
+
Use this method to solve MTCaptcha and obtain a token to bypass the protection.
|
|
276
|
+
```python
|
|
277
|
+
result = solver.mtcaptcha(sitekey='MTPublic-KzqLY1cKH',
|
|
278
|
+
url='https://2captcha.com/demo/mtcaptcha',
|
|
279
|
+
param1=..., ...)
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Friendly Captcha
|
|
283
|
+
Friendly Captcha solving method. Returns a token.
|
|
284
|
+
```python
|
|
285
|
+
result = solver.friendly_captcha(sitekey='FCMGEMUD2KTDSQ5H',
|
|
286
|
+
url='https://friendlycaptcha.com/demo',
|
|
287
|
+
param1=..., ...)
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Cutcaptcha
|
|
291
|
+
Use this method to solve Cutcaptcha. Returns the response in JSON.
|
|
292
|
+
```python
|
|
293
|
+
result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320',
|
|
294
|
+
apikey='SAs61IAI',
|
|
295
|
+
url='https://mysite.com/page/with/cutcaptcha',
|
|
296
|
+
param1=..., ...)
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
|
|
257
300
|
## Other methods
|
|
258
301
|
|
|
259
302
|
### send / getResult
|
|
@@ -8,6 +8,7 @@ The easiest way to quickly integrate [2Captcha] captcha solving service into you
|
|
|
8
8
|
- [Solve captcha](#solve-captcha)
|
|
9
9
|
- [Captcha options](#captcha-options)
|
|
10
10
|
- [Normal Captcha](#normal-captcha)
|
|
11
|
+
- [Audio Captcha](#audio-captcha)
|
|
11
12
|
- [Text Captcha](#text-captcha)
|
|
12
13
|
- [ReCaptcha v2](#recaptcha-v2)
|
|
13
14
|
- [ReCaptcha v3](#recaptcha-v3)
|
|
@@ -24,6 +25,9 @@ The easiest way to quickly integrate [2Captcha] captcha solving service into you
|
|
|
24
25
|
- [Canvas](#canvas)
|
|
25
26
|
- [ClickCaptcha](#clickcaptcha)
|
|
26
27
|
- [Rotate](#rotate)
|
|
28
|
+
- [MTCaptcha](#mtcaptcha)
|
|
29
|
+
- [Friendly Captcha](#friendly_captcha)
|
|
30
|
+
- [Cutcaptcha](#cutcaptcha)
|
|
27
31
|
- [Other methods](#other-methods)
|
|
28
32
|
- [send / getResult](#send--getresult)
|
|
29
33
|
- [balance](#balance)
|
|
@@ -103,6 +107,16 @@ result = solver.normal('path/to/captcha.jpg', param1=..., ...)
|
|
|
103
107
|
result = solver.normal('https://site-with-captcha.com/path/to/captcha.jpg', param1=..., ...)
|
|
104
108
|
```
|
|
105
109
|
|
|
110
|
+
### Audio Captcha
|
|
111
|
+
To bypass an audio captcha (mp3 formats only) use the following method.
|
|
112
|
+
You must provife the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt".
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
result = solver.audio('path/to/captcha.mp3', lang = 'lang', param1=..., ...)
|
|
116
|
+
# OR
|
|
117
|
+
result = solver.audio('https://site-with-captcha.com/path/to/captcha.mp3', lang = 'lang', param1=..., ...)
|
|
118
|
+
```
|
|
119
|
+
|
|
106
120
|
### Text Captcha
|
|
107
121
|
This method can be used to bypass a captcha that requires to answer a question provided in clear text.
|
|
108
122
|
```python
|
|
@@ -182,8 +196,10 @@ Use this method to solve Cloudflare Turnstile. Returns JSON with the token.
|
|
|
182
196
|
```python
|
|
183
197
|
result = solver.turnstile(sitekey='0x1AAAAAAAAkg0s2VIOD34y5',
|
|
184
198
|
url='http://mysite.com/',
|
|
185
|
-
|
|
186
|
-
|
|
199
|
+
data='foo',
|
|
200
|
+
pagedata='bar',
|
|
201
|
+
action='challenge',
|
|
202
|
+
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')
|
|
187
203
|
```
|
|
188
204
|
|
|
189
205
|
### Amazon WAF
|
|
@@ -240,6 +256,32 @@ This method can be used to solve a captcha that asks to rotate an object. Mostly
|
|
|
240
256
|
result = solver.rotate('path/to/captcha.jpg', param1=..., ...)
|
|
241
257
|
```
|
|
242
258
|
|
|
259
|
+
### MTCaptcha
|
|
260
|
+
Use this method to solve MTCaptcha and obtain a token to bypass the protection.
|
|
261
|
+
```python
|
|
262
|
+
result = solver.mtcaptcha(sitekey='MTPublic-KzqLY1cKH',
|
|
263
|
+
url='https://2captcha.com/demo/mtcaptcha',
|
|
264
|
+
param1=..., ...)
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Friendly Captcha
|
|
268
|
+
Friendly Captcha solving method. Returns a token.
|
|
269
|
+
```python
|
|
270
|
+
result = solver.friendly_captcha(sitekey='FCMGEMUD2KTDSQ5H',
|
|
271
|
+
url='https://friendlycaptcha.com/demo',
|
|
272
|
+
param1=..., ...)
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Cutcaptcha
|
|
276
|
+
Use this method to solve Cutcaptcha. Returns the response in JSON.
|
|
277
|
+
```python
|
|
278
|
+
result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320',
|
|
279
|
+
apikey='SAs61IAI',
|
|
280
|
+
url='https://mysite.com/page/with/cutcaptcha',
|
|
281
|
+
param1=..., ...)
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
|
|
243
285
|
## Other methods
|
|
244
286
|
|
|
245
287
|
### send / getResult
|
|
@@ -0,0 +1,31 @@
|
|
|
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 CutcaptchaTest(AbstractTest):
|
|
12
|
+
|
|
13
|
+
def test_all_params(self):
|
|
14
|
+
params = {
|
|
15
|
+
'misery_key': 'ad52c87af17e2ec09b8d918c9f00416b1cb8c320',
|
|
16
|
+
'apikey': 'SAs61IAI',
|
|
17
|
+
'url': 'https://www.site.com/page/',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
sends = {
|
|
21
|
+
'method': 'cutcaptcha',
|
|
22
|
+
'api_key': 'SAs61IAI',
|
|
23
|
+
'misery_key': 'ad52c87af17e2ec09b8d918c9f00416b1cb8c320',
|
|
24
|
+
'pageurl': 'https://www.site.com/page/',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return self.send_return(sends, self.solver.cutcaptcha, **params)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
if __name__ == '__main__':
|
|
31
|
+
unittest.main()
|
|
@@ -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 FriendlyCaptchaTest(AbstractTest):
|
|
12
|
+
|
|
13
|
+
def test_all_params(self):
|
|
14
|
+
params = {
|
|
15
|
+
'sitekey': 'FCMGEMUD2KTDSQ5H',
|
|
16
|
+
'url': 'https://friendlycaptcha.com/demo',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
sends = {
|
|
20
|
+
'method': 'friendly_captcha',
|
|
21
|
+
'sitekey': 'FCMGEMUD2KTDSQ5H',
|
|
22
|
+
'pageurl': 'https://friendlycaptcha.com/demo',
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return self.send_return(sends, self.solver.friendly_captcha, **params)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
if __name__ == '__main__':
|
|
29
|
+
unittest.main()
|
|
@@ -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 MTCaptchaTest(AbstractTest):
|
|
12
|
+
|
|
13
|
+
def test_all_params(self):
|
|
14
|
+
params = {
|
|
15
|
+
'sitekey': 'MTPublic-KzqLY1cKH',
|
|
16
|
+
'url': 'https://2captcha.com/demo/mtcaptcha',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
sends = {
|
|
20
|
+
'method': 'mt_captcha',
|
|
21
|
+
'sitekey': 'MTPublic-KzqLY1cKH',
|
|
22
|
+
'pageurl': 'https://2captcha.com/demo/mtcaptcha',
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return self.send_return(sends, self.solver.mtcaptcha, **params)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
if __name__ == '__main__':
|
|
29
|
+
unittest.main()
|
|
@@ -81,6 +81,39 @@ class TwoCaptcha():
|
|
|
81
81
|
result = self.solve(**method, **kwargs)
|
|
82
82
|
return result
|
|
83
83
|
|
|
84
|
+
def audio(self, file, lang, **kwargs):
|
|
85
|
+
'''
|
|
86
|
+
Wrapper for solving audio captcha
|
|
87
|
+
|
|
88
|
+
Required:
|
|
89
|
+
file (base64, or url to mp3 file)
|
|
90
|
+
lang ("en", "ru", "de", "el", "pt")
|
|
91
|
+
|
|
92
|
+
Optional params:
|
|
93
|
+
'''
|
|
94
|
+
method = "audio"
|
|
95
|
+
|
|
96
|
+
if not file:
|
|
97
|
+
raise ValidationException('File is none')
|
|
98
|
+
elif not '.' in file and len(file) > 50:
|
|
99
|
+
body = file
|
|
100
|
+
elif file.endswith(".mp3") and file.startswith("http"):
|
|
101
|
+
response = requests.get(file)
|
|
102
|
+
if response.status_code != 200:
|
|
103
|
+
raise ValidationException(f'File could not be downloaded from url: {file}')
|
|
104
|
+
body = b64encode(response.content).decode('utf-8')
|
|
105
|
+
elif file.endswith(".mp3"):
|
|
106
|
+
with open(file, "rb") as media:
|
|
107
|
+
body = b64encode(media.read()).decode('utf-8')
|
|
108
|
+
else:
|
|
109
|
+
raise ValidationException('File extension is not .mp3 or it is not a base64 string.')
|
|
110
|
+
|
|
111
|
+
if not lang or lang not in ("en", "ru", "de", "el", "pt"):
|
|
112
|
+
raise ValidationException(f'Lang not in "en", "ru", "de", "el", "pt". You send {lang}')
|
|
113
|
+
|
|
114
|
+
result = self.solve(body=body, method=method, **kwargs)
|
|
115
|
+
return result
|
|
116
|
+
|
|
84
117
|
def text(self, text, **kwargs):
|
|
85
118
|
'''
|
|
86
119
|
Wrapper for solving text captcha
|
|
@@ -470,7 +503,67 @@ class TwoCaptcha():
|
|
|
470
503
|
|
|
471
504
|
return result
|
|
472
505
|
|
|
506
|
+
def mtcaptcha(self, sitekey, url, **kwargs):
|
|
507
|
+
'''
|
|
508
|
+
Wrapper for solving MTCaptcha
|
|
509
|
+
|
|
510
|
+
Required:
|
|
511
|
+
sitekey
|
|
512
|
+
url
|
|
513
|
+
|
|
514
|
+
Optional params:
|
|
515
|
+
softId
|
|
516
|
+
callback
|
|
517
|
+
proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
|
|
518
|
+
'''
|
|
519
|
+
|
|
520
|
+
result = self.solve(sitekey=sitekey,
|
|
521
|
+
url=url,
|
|
522
|
+
method='mt_captcha',
|
|
523
|
+
**kwargs)
|
|
524
|
+
return result
|
|
525
|
+
|
|
526
|
+
def friendly_captcha(self, sitekey, url, **kwargs):
|
|
527
|
+
'''
|
|
528
|
+
Wrapper for solving Friendly Captcha
|
|
529
|
+
|
|
530
|
+
Required:
|
|
531
|
+
sitekey
|
|
532
|
+
url
|
|
533
|
+
|
|
534
|
+
Optional params:
|
|
535
|
+
softId
|
|
536
|
+
callback
|
|
537
|
+
proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
|
|
538
|
+
'''
|
|
539
|
+
|
|
540
|
+
result = self.solve(sitekey=sitekey,
|
|
541
|
+
url=url,
|
|
542
|
+
method='friendly_captcha',
|
|
543
|
+
**kwargs)
|
|
544
|
+
return result
|
|
545
|
+
|
|
546
|
+
def cutcaptcha(self, misery_key, apikey, url, **kwargs):
|
|
547
|
+
'''
|
|
548
|
+
Wrapper for solving Friendly Captcha
|
|
473
549
|
|
|
550
|
+
Required:
|
|
551
|
+
misery_key
|
|
552
|
+
apikey
|
|
553
|
+
url
|
|
554
|
+
|
|
555
|
+
Optional params:
|
|
556
|
+
softId
|
|
557
|
+
callback
|
|
558
|
+
proxy = {'type': 'HTTPS', 'uri': 'login:password@IP_address:PORT'})
|
|
559
|
+
'''
|
|
560
|
+
|
|
561
|
+
result = self.solve(misery_key=misery_key,
|
|
562
|
+
api_key=apikey,
|
|
563
|
+
url=url,
|
|
564
|
+
method='cutcaptcha',
|
|
565
|
+
**kwargs)
|
|
566
|
+
return result
|
|
474
567
|
|
|
475
568
|
def solve(self, timeout=0, polling_interval=0, **kwargs):
|
|
476
569
|
'''
|
|
@@ -524,7 +617,7 @@ class TwoCaptcha():
|
|
|
524
617
|
|
|
525
618
|
if not '.' in file and len(file) > 50:
|
|
526
619
|
return {'method': 'base64', 'body': file}
|
|
527
|
-
|
|
620
|
+
|
|
528
621
|
if file.startswith('http'):
|
|
529
622
|
img_resp = requests.get(file)
|
|
530
623
|
if img_resp.status_code != 200:
|
{2captcha-python-1.2.1 → 2captcha-python-1.2.3}/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
|