2captcha-python 1.2.4__tar.gz → 1.2.6__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.4 → 2captcha_python-1.2.6}/2captcha_python.egg-info/PKG-INFO +34 -16
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/2captcha_python.egg-info/SOURCES.txt +1 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/PKG-INFO +34 -16
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/README.md +33 -15
- 2captcha_python-1.2.6/tests/test_tencent.py +29 -0
- 2captcha_python-1.2.6/twocaptcha/__init__.py +15 -0
- 2captcha_python-1.2.6/twocaptcha/solver.py +1045 -0
- 2captcha-python-1.2.4/twocaptcha/__init__.py +0 -5
- 2captcha-python-1.2.4/twocaptcha/solver.py +0 -802
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/2captcha_python.egg-info/dependency_links.txt +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/2captcha_python.egg-info/requires.txt +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/2captcha_python.egg-info/top_level.txt +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/LICENSE +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/setup.cfg +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/setup.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_amazon_waf.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_atb_captcha.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_canvas.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_capy.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_coordinates.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_cutcaptcha.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_friendly_captcha.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_funcaptcha.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_geetest.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_geetest_v4.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_grid.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_hcaptcha.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_keycaptcha.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_lemin.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_mtcaptcha.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_normal.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_recaptcha.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_rotate.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_text.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/tests/test_turnstile.py +0 -0
- {2captcha-python-1.2.4 → 2captcha_python-1.2.6}/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.6
|
|
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
|
|
@@ -44,8 +44,9 @@ The easiest way to quickly integrate the 2Captcha captcha-solving service into y
|
|
|
44
44
|
- [MTCaptcha](#mtcaptcha)
|
|
45
45
|
- [Friendly Captcha](#friendly-captcha)
|
|
46
46
|
- [Cutcaptcha](#cutcaptcha)
|
|
47
|
+
- [Tencent](#tencent)
|
|
47
48
|
- [Other methods](#other-methods)
|
|
48
|
-
- [send /
|
|
49
|
+
- [send / get_result](#send--get_result)
|
|
49
50
|
- [balance](#balance)
|
|
50
51
|
- [report](#report)
|
|
51
52
|
- [Error handling](#error-handling)
|
|
@@ -95,7 +96,7 @@ solver = TwoCaptcha(**config)
|
|
|
95
96
|
| pollingInterval | 10 | Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended |
|
|
96
97
|
|
|
97
98
|
> **IMPORTANT:** once `callback` is defined for `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.
|
|
98
|
-
To get the answer manually use [
|
|
99
|
+
To get the answer manually use [get_result method](#send--get_result)
|
|
99
100
|
|
|
100
101
|
## Solve captcha
|
|
101
102
|
When you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.
|
|
@@ -125,7 +126,7 @@ result = solver.normal('https://site-with-captcha.com/path/to/captcha.jpg', para
|
|
|
125
126
|
|
|
126
127
|
### Audio Captcha
|
|
127
128
|
To bypass an audio captcha (mp3 formats only) use the following method.
|
|
128
|
-
You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt".
|
|
129
|
+
You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt", "fr".
|
|
129
130
|
|
|
130
131
|
```python
|
|
131
132
|
result = solver.audio('path/to/captcha.mp3', lang = 'lang', param1=..., ...)
|
|
@@ -177,20 +178,21 @@ result = solver.geetest(gt='f1ab2cdefa3456789012345b6c78d90e',
|
|
|
177
178
|
```
|
|
178
179
|
|
|
179
180
|
|
|
180
|
-
###
|
|
181
|
-
Use this method to solve
|
|
181
|
+
### GeeTest v4
|
|
182
|
+
Use this method to solve GeeTest v4. Returns the response in JSON.
|
|
182
183
|
```python
|
|
183
|
-
result = solver.
|
|
184
|
-
url='https://www.site.com/page/',
|
|
184
|
+
result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
|
|
185
|
+
url='https://www.site.com/page/',
|
|
185
186
|
param1=..., ...)
|
|
186
187
|
|
|
187
188
|
```
|
|
188
189
|
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
|
|
191
|
+
### hCaptcha
|
|
192
|
+
Use this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.
|
|
191
193
|
```python
|
|
192
|
-
result = solver.
|
|
193
|
-
url='https://www.site.com/page/',
|
|
194
|
+
result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
|
|
195
|
+
url='https://www.site.com/page/',
|
|
194
196
|
param1=..., ...)
|
|
195
197
|
|
|
196
198
|
```
|
|
@@ -311,10 +313,17 @@ result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320'
|
|
|
311
313
|
param1=..., ...)
|
|
312
314
|
```
|
|
313
315
|
|
|
316
|
+
### Tencent
|
|
317
|
+
Use this method to solve Cutcaptcha. Returns a token.
|
|
318
|
+
```python
|
|
319
|
+
result = solver.tencent(app_id="197326679",
|
|
320
|
+
url="https://mysite.com/page/with/tencent",
|
|
321
|
+
param1=..., ...)
|
|
322
|
+
```
|
|
314
323
|
|
|
315
324
|
## Other methods
|
|
316
325
|
|
|
317
|
-
### send /
|
|
326
|
+
### send / get_result
|
|
318
327
|
These methods can be used for manual captcha submission and answer polling.
|
|
319
328
|
```python
|
|
320
329
|
import time
|
|
@@ -362,7 +371,11 @@ except TimeoutException as e:
|
|
|
362
371
|
|
|
363
372
|
### Proxies
|
|
364
373
|
|
|
365
|
-
You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha
|
|
374
|
+
You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha,
|
|
375
|
+
keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, tencent, amazon waf, mtcaptcha, friendly captcha, cutcaptcha.
|
|
376
|
+
The proxy will be forwarded to the API to solve the captcha.
|
|
377
|
+
|
|
378
|
+
We have our own proxies that we can offer you. [Buy residential proxies] for avoid restrictions and blocks. [Quick start].
|
|
366
379
|
|
|
367
380
|
```python
|
|
368
381
|
proxy={
|
|
@@ -379,13 +392,16 @@ import asyncio
|
|
|
379
392
|
import concurrent.futures
|
|
380
393
|
from twocaptcha import TwoCaptcha
|
|
381
394
|
|
|
382
|
-
|
|
395
|
+
API_KEY = "YOUR_API_KEY"
|
|
396
|
+
image = "data:image/png;base64,iVBORw0KGgoA..."
|
|
383
397
|
|
|
384
398
|
async def captchaSolver(image):
|
|
385
399
|
loop = asyncio.get_running_loop()
|
|
386
|
-
with concurrent.
|
|
400
|
+
with concurrent.futures.ThreadPoolExecutor() as pool:
|
|
387
401
|
result = await loop.run_in_executor(pool, lambda: TwoCaptcha(API_KEY).normal(image))
|
|
388
402
|
return result
|
|
403
|
+
|
|
404
|
+
captcha_result = asyncio.run(captchaSolver(image))
|
|
389
405
|
```
|
|
390
406
|
|
|
391
407
|
|
|
@@ -396,3 +412,5 @@ async def captchaSolver(image):
|
|
|
396
412
|
[list of supported languages]: https://2captcha.com/2captcha-api#language
|
|
397
413
|
[examples directory]: /examples
|
|
398
414
|
[asyncio]: https://docs.python.org/3/library/asyncio.html
|
|
415
|
+
[Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
|
|
416
|
+
[Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: 2captcha-python
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.6
|
|
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
|
|
@@ -44,8 +44,9 @@ The easiest way to quickly integrate the 2Captcha captcha-solving service into y
|
|
|
44
44
|
- [MTCaptcha](#mtcaptcha)
|
|
45
45
|
- [Friendly Captcha](#friendly-captcha)
|
|
46
46
|
- [Cutcaptcha](#cutcaptcha)
|
|
47
|
+
- [Tencent](#tencent)
|
|
47
48
|
- [Other methods](#other-methods)
|
|
48
|
-
- [send /
|
|
49
|
+
- [send / get_result](#send--get_result)
|
|
49
50
|
- [balance](#balance)
|
|
50
51
|
- [report](#report)
|
|
51
52
|
- [Error handling](#error-handling)
|
|
@@ -95,7 +96,7 @@ solver = TwoCaptcha(**config)
|
|
|
95
96
|
| pollingInterval | 10 | Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended |
|
|
96
97
|
|
|
97
98
|
> **IMPORTANT:** once `callback` is defined for `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.
|
|
98
|
-
To get the answer manually use [
|
|
99
|
+
To get the answer manually use [get_result method](#send--get_result)
|
|
99
100
|
|
|
100
101
|
## Solve captcha
|
|
101
102
|
When you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.
|
|
@@ -125,7 +126,7 @@ result = solver.normal('https://site-with-captcha.com/path/to/captcha.jpg', para
|
|
|
125
126
|
|
|
126
127
|
### Audio Captcha
|
|
127
128
|
To bypass an audio captcha (mp3 formats only) use the following method.
|
|
128
|
-
You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt".
|
|
129
|
+
You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt", "fr".
|
|
129
130
|
|
|
130
131
|
```python
|
|
131
132
|
result = solver.audio('path/to/captcha.mp3', lang = 'lang', param1=..., ...)
|
|
@@ -177,20 +178,21 @@ result = solver.geetest(gt='f1ab2cdefa3456789012345b6c78d90e',
|
|
|
177
178
|
```
|
|
178
179
|
|
|
179
180
|
|
|
180
|
-
###
|
|
181
|
-
Use this method to solve
|
|
181
|
+
### GeeTest v4
|
|
182
|
+
Use this method to solve GeeTest v4. Returns the response in JSON.
|
|
182
183
|
```python
|
|
183
|
-
result = solver.
|
|
184
|
-
url='https://www.site.com/page/',
|
|
184
|
+
result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
|
|
185
|
+
url='https://www.site.com/page/',
|
|
185
186
|
param1=..., ...)
|
|
186
187
|
|
|
187
188
|
```
|
|
188
189
|
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
|
|
191
|
+
### hCaptcha
|
|
192
|
+
Use this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.
|
|
191
193
|
```python
|
|
192
|
-
result = solver.
|
|
193
|
-
url='https://www.site.com/page/',
|
|
194
|
+
result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
|
|
195
|
+
url='https://www.site.com/page/',
|
|
194
196
|
param1=..., ...)
|
|
195
197
|
|
|
196
198
|
```
|
|
@@ -311,10 +313,17 @@ result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320'
|
|
|
311
313
|
param1=..., ...)
|
|
312
314
|
```
|
|
313
315
|
|
|
316
|
+
### Tencent
|
|
317
|
+
Use this method to solve Cutcaptcha. Returns a token.
|
|
318
|
+
```python
|
|
319
|
+
result = solver.tencent(app_id="197326679",
|
|
320
|
+
url="https://mysite.com/page/with/tencent",
|
|
321
|
+
param1=..., ...)
|
|
322
|
+
```
|
|
314
323
|
|
|
315
324
|
## Other methods
|
|
316
325
|
|
|
317
|
-
### send /
|
|
326
|
+
### send / get_result
|
|
318
327
|
These methods can be used for manual captcha submission and answer polling.
|
|
319
328
|
```python
|
|
320
329
|
import time
|
|
@@ -362,7 +371,11 @@ except TimeoutException as e:
|
|
|
362
371
|
|
|
363
372
|
### Proxies
|
|
364
373
|
|
|
365
|
-
You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha
|
|
374
|
+
You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha,
|
|
375
|
+
keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, tencent, amazon waf, mtcaptcha, friendly captcha, cutcaptcha.
|
|
376
|
+
The proxy will be forwarded to the API to solve the captcha.
|
|
377
|
+
|
|
378
|
+
We have our own proxies that we can offer you. [Buy residential proxies] for avoid restrictions and blocks. [Quick start].
|
|
366
379
|
|
|
367
380
|
```python
|
|
368
381
|
proxy={
|
|
@@ -379,13 +392,16 @@ import asyncio
|
|
|
379
392
|
import concurrent.futures
|
|
380
393
|
from twocaptcha import TwoCaptcha
|
|
381
394
|
|
|
382
|
-
|
|
395
|
+
API_KEY = "YOUR_API_KEY"
|
|
396
|
+
image = "data:image/png;base64,iVBORw0KGgoA..."
|
|
383
397
|
|
|
384
398
|
async def captchaSolver(image):
|
|
385
399
|
loop = asyncio.get_running_loop()
|
|
386
|
-
with concurrent.
|
|
400
|
+
with concurrent.futures.ThreadPoolExecutor() as pool:
|
|
387
401
|
result = await loop.run_in_executor(pool, lambda: TwoCaptcha(API_KEY).normal(image))
|
|
388
402
|
return result
|
|
403
|
+
|
|
404
|
+
captcha_result = asyncio.run(captchaSolver(image))
|
|
389
405
|
```
|
|
390
406
|
|
|
391
407
|
|
|
@@ -396,3 +412,5 @@ async def captchaSolver(image):
|
|
|
396
412
|
[list of supported languages]: https://2captcha.com/2captcha-api#language
|
|
397
413
|
[examples directory]: /examples
|
|
398
414
|
[asyncio]: https://docs.python.org/3/library/asyncio.html
|
|
415
|
+
[Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
|
|
416
|
+
[Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
|
|
@@ -29,8 +29,9 @@ The easiest way to quickly integrate the 2Captcha captcha-solving service into y
|
|
|
29
29
|
- [MTCaptcha](#mtcaptcha)
|
|
30
30
|
- [Friendly Captcha](#friendly-captcha)
|
|
31
31
|
- [Cutcaptcha](#cutcaptcha)
|
|
32
|
+
- [Tencent](#tencent)
|
|
32
33
|
- [Other methods](#other-methods)
|
|
33
|
-
- [send /
|
|
34
|
+
- [send / get_result](#send--get_result)
|
|
34
35
|
- [balance](#balance)
|
|
35
36
|
- [report](#report)
|
|
36
37
|
- [Error handling](#error-handling)
|
|
@@ -80,7 +81,7 @@ solver = TwoCaptcha(**config)
|
|
|
80
81
|
| pollingInterval | 10 | Interval in seconds between requests to `res.php` API endpoint, setting values less than 5 seconds is not recommended |
|
|
81
82
|
|
|
82
83
|
> **IMPORTANT:** once `callback` is defined for `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.
|
|
83
|
-
To get the answer manually use [
|
|
84
|
+
To get the answer manually use [get_result method](#send--get_result)
|
|
84
85
|
|
|
85
86
|
## Solve captcha
|
|
86
87
|
When you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.
|
|
@@ -110,7 +111,7 @@ result = solver.normal('https://site-with-captcha.com/path/to/captcha.jpg', para
|
|
|
110
111
|
|
|
111
112
|
### Audio Captcha
|
|
112
113
|
To bypass an audio captcha (mp3 formats only) use the following method.
|
|
113
|
-
You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt".
|
|
114
|
+
You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt", "fr".
|
|
114
115
|
|
|
115
116
|
```python
|
|
116
117
|
result = solver.audio('path/to/captcha.mp3', lang = 'lang', param1=..., ...)
|
|
@@ -162,20 +163,21 @@ result = solver.geetest(gt='f1ab2cdefa3456789012345b6c78d90e',
|
|
|
162
163
|
```
|
|
163
164
|
|
|
164
165
|
|
|
165
|
-
###
|
|
166
|
-
Use this method to solve
|
|
166
|
+
### GeeTest v4
|
|
167
|
+
Use this method to solve GeeTest v4. Returns the response in JSON.
|
|
167
168
|
```python
|
|
168
|
-
result = solver.
|
|
169
|
-
url='https://www.site.com/page/',
|
|
169
|
+
result = solver.geetest_v4(captcha_id='e392e1d7fd421dc63325744d5a2b9c73',
|
|
170
|
+
url='https://www.site.com/page/',
|
|
170
171
|
param1=..., ...)
|
|
171
172
|
|
|
172
173
|
```
|
|
173
174
|
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
|
|
176
|
+
### hCaptcha
|
|
177
|
+
Use this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.
|
|
176
178
|
```python
|
|
177
|
-
result = solver.
|
|
178
|
-
url='https://www.site.com/page/',
|
|
179
|
+
result = solver.hcaptcha(sitekey='10000000-ffff-ffff-ffff-000000000001',
|
|
180
|
+
url='https://www.site.com/page/',
|
|
179
181
|
param1=..., ...)
|
|
180
182
|
|
|
181
183
|
```
|
|
@@ -296,10 +298,17 @@ result = solver.cutcaptcha(misery_key='ad52c87af17e2ec09b8d918c9f00416b1cb8c320'
|
|
|
296
298
|
param1=..., ...)
|
|
297
299
|
```
|
|
298
300
|
|
|
301
|
+
### Tencent
|
|
302
|
+
Use this method to solve Cutcaptcha. Returns a token.
|
|
303
|
+
```python
|
|
304
|
+
result = solver.tencent(app_id="197326679",
|
|
305
|
+
url="https://mysite.com/page/with/tencent",
|
|
306
|
+
param1=..., ...)
|
|
307
|
+
```
|
|
299
308
|
|
|
300
309
|
## Other methods
|
|
301
310
|
|
|
302
|
-
### send /
|
|
311
|
+
### send / get_result
|
|
303
312
|
These methods can be used for manual captcha submission and answer polling.
|
|
304
313
|
```python
|
|
305
314
|
import time
|
|
@@ -347,7 +356,11 @@ except TimeoutException as e:
|
|
|
347
356
|
|
|
348
357
|
### Proxies
|
|
349
358
|
|
|
350
|
-
You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha
|
|
359
|
+
You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha,
|
|
360
|
+
keycaptcha, capy puzzle, lemin, atbcaptcha, turnstile, tencent, amazon waf, mtcaptcha, friendly captcha, cutcaptcha.
|
|
361
|
+
The proxy will be forwarded to the API to solve the captcha.
|
|
362
|
+
|
|
363
|
+
We have our own proxies that we can offer you. [Buy residential proxies] for avoid restrictions and blocks. [Quick start].
|
|
351
364
|
|
|
352
365
|
```python
|
|
353
366
|
proxy={
|
|
@@ -364,13 +377,16 @@ import asyncio
|
|
|
364
377
|
import concurrent.futures
|
|
365
378
|
from twocaptcha import TwoCaptcha
|
|
366
379
|
|
|
367
|
-
|
|
380
|
+
API_KEY = "YOUR_API_KEY"
|
|
381
|
+
image = "data:image/png;base64,iVBORw0KGgoA..."
|
|
368
382
|
|
|
369
383
|
async def captchaSolver(image):
|
|
370
384
|
loop = asyncio.get_running_loop()
|
|
371
|
-
with concurrent.
|
|
385
|
+
with concurrent.futures.ThreadPoolExecutor() as pool:
|
|
372
386
|
result = await loop.run_in_executor(pool, lambda: TwoCaptcha(API_KEY).normal(image))
|
|
373
387
|
return result
|
|
388
|
+
|
|
389
|
+
captcha_result = asyncio.run(captchaSolver(image))
|
|
374
390
|
```
|
|
375
391
|
|
|
376
392
|
|
|
@@ -381,3 +397,5 @@ async def captchaSolver(image):
|
|
|
381
397
|
[list of supported languages]: https://2captcha.com/2captcha-api#language
|
|
382
398
|
[examples directory]: /examples
|
|
383
399
|
[asyncio]: https://docs.python.org/3/library/asyncio.html
|
|
400
|
+
[Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
|
|
401
|
+
[Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
|
|
@@ -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 TencentTest(AbstractTest):
|
|
12
|
+
|
|
13
|
+
def test_all_params(self):
|
|
14
|
+
params = {
|
|
15
|
+
"app_id": "197322596",
|
|
16
|
+
"url": "https://www.holla.world/random-video-chat#app"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
sends = {
|
|
20
|
+
"method": "tencent",
|
|
21
|
+
"app_id": "197322596",
|
|
22
|
+
"pageurl": "https://www.holla.world/random-video-chat#app",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return self.send_return(sends, self.solver.tencent, **params)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
if __name__ == '__main__':
|
|
29
|
+
unittest.main()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from .api import ApiClient
|
|
2
|
+
from .solver import (TwoCaptcha, SolverExceptions, ValidationException,
|
|
3
|
+
NetworkException, ApiException, TimeoutException)
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
Python 3 package for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, hcaptcha,
|
|
7
|
+
funcaptcha, geetest and solve any other captchas.
|
|
8
|
+
|
|
9
|
+
website 2captcha [https://2captcha.com/]
|
|
10
|
+
support@2captcha.com
|
|
11
|
+
# License: MIT
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
__author__ = '2captcha'
|
|
15
|
+
__version__ = '1.2.6'
|