2captcha-python 1.5.1__tar.gz → 2.0.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.
- {2captcha_python-1.5.1 → 2captcha_python-2.0.1/2captcha_python.egg-info}/PKG-INFO +134 -10
- 2captcha_python-2.0.1/2captcha_python.egg-info/SOURCES.txt +16 -0
- 2captcha_python-2.0.1/2captcha_python.egg-info/requires.txt +3 -0
- 2captcha_python-1.5.1/README.md → 2captcha_python-2.0.1/PKG-INFO +160 -6
- 2captcha_python-1.5.1/2captcha_python.egg-info/PKG-INFO → 2captcha_python-2.0.1/README.md +127 -36
- {2captcha_python-1.5.1 → 2captcha_python-2.0.1}/setup.py +5 -5
- {2captcha_python-1.5.1 → 2captcha_python-2.0.1}/twocaptcha/__init__.py +8 -3
- {2captcha_python-1.5.1 → 2captcha_python-2.0.1}/twocaptcha/api.py +8 -12
- 2captcha_python-2.0.1/twocaptcha/async_api.py +124 -0
- 2captcha_python-2.0.1/twocaptcha/async_solver.py +1217 -0
- 2captcha_python-2.0.1/twocaptcha/exceptions/__init__.py +0 -0
- 2captcha_python-2.0.1/twocaptcha/exceptions/api.py +6 -0
- 2captcha_python-2.0.1/twocaptcha/exceptions/solver.py +18 -0
- {2captcha_python-1.5.1 → 2captcha_python-2.0.1}/twocaptcha/solver.py +259 -45
- 2captcha_python-1.5.1/2captcha_python.egg-info/SOURCES.txt +0 -35
- 2captcha_python-1.5.1/2captcha_python.egg-info/requires.txt +0 -1
- 2captcha_python-1.5.1/tests/test_amazon_waf.py +0 -42
- 2captcha_python-1.5.1/tests/test_atb_captcha.py +0 -31
- 2captcha_python-1.5.1/tests/test_canvas.py +0 -89
- 2captcha_python-1.5.1/tests/test_capy.py +0 -38
- 2captcha_python-1.5.1/tests/test_coordinates.py +0 -84
- 2captcha_python-1.5.1/tests/test_cutcaptcha.py +0 -31
- 2captcha_python-1.5.1/tests/test_cybersiara.py +0 -32
- 2captcha_python-1.5.1/tests/test_datadome.py +0 -34
- 2captcha_python-1.5.1/tests/test_friendly_captcha.py +0 -29
- 2captcha_python-1.5.1/tests/test_funcaptcha.py +0 -44
- 2captcha_python-1.5.1/tests/test_geetest.py +0 -41
- 2captcha_python-1.5.1/tests/test_geetest_v4.py +0 -34
- 2captcha_python-1.5.1/tests/test_grid.py +0 -91
- 2captcha_python-1.5.1/tests/test_hcaptcha.py +0 -38
- 2captcha_python-1.5.1/tests/test_keycaptcha.py +0 -44
- 2captcha_python-1.5.1/tests/test_lemin.py +0 -42
- 2captcha_python-1.5.1/tests/test_mtcaptcha.py +0 -29
- 2captcha_python-1.5.1/tests/test_normal.py +0 -102
- 2captcha_python-1.5.1/tests/test_recaptcha.py +0 -66
- 2captcha_python-1.5.1/tests/test_rotate.py +0 -109
- 2captcha_python-1.5.1/tests/test_tencent.py +0 -29
- 2captcha_python-1.5.1/tests/test_text.py +0 -40
- 2captcha_python-1.5.1/tests/test_turnstile.py +0 -36
- 2captcha_python-1.5.1/tests/test_yandex_smart_captcha.py +0 -29
- {2captcha_python-1.5.1 → 2captcha_python-2.0.1}/2captcha_python.egg-info/dependency_links.txt +0 -0
- {2captcha_python-1.5.1 → 2captcha_python-2.0.1}/2captcha_python.egg-info/top_level.txt +0 -0
- {2captcha_python-1.5.1 → 2captcha_python-2.0.1}/LICENSE +0 -0
- {2captcha_python-1.5.1 → 2captcha_python-2.0.1}/setup.cfg +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: 2captcha-python
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.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,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,VK Captcha,CaptchaFox,Prosopo,cybersiara
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
@@ -13,10 +13,12 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
13
13
|
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
14
14
|
Classifier: Topic :: Utilities
|
|
15
15
|
Classifier: Intended Audience :: Developers
|
|
16
|
-
Requires-Python: >=3.
|
|
16
|
+
Requires-Python: >=3.8
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
19
|
Requires-Dist: requests
|
|
20
|
+
Requires-Dist: httpx
|
|
21
|
+
Requires-Dist: aiofiles
|
|
20
22
|
Dynamic: author
|
|
21
23
|
Dynamic: author-email
|
|
22
24
|
Dynamic: classifier
|
|
@@ -24,6 +26,7 @@ Dynamic: description
|
|
|
24
26
|
Dynamic: description-content-type
|
|
25
27
|
Dynamic: home-page
|
|
26
28
|
Dynamic: keywords
|
|
29
|
+
Dynamic: license-file
|
|
27
30
|
Dynamic: requires-dist
|
|
28
31
|
Dynamic: requires-python
|
|
29
32
|
Dynamic: summary
|
|
@@ -72,6 +75,10 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
72
75
|
- [Cutcaptcha](#cutcaptcha)
|
|
73
76
|
- [Tencent](#tencent)
|
|
74
77
|
- [DataDome](#datadome)
|
|
78
|
+
- [VKImage](#vkimage)
|
|
79
|
+
- [VKCaptcha](#vkcaptcha)
|
|
80
|
+
- [CaptchaFox](#captchafox)
|
|
81
|
+
- [Prosopo](#prosopo)
|
|
75
82
|
- [CyberSiARA](#cybersiara)
|
|
76
83
|
- [Other methods](#other-methods)
|
|
77
84
|
- [send / get\_result](#send--get_result)
|
|
@@ -82,11 +89,11 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
82
89
|
- [Async calls](#async-calls)
|
|
83
90
|
- [Examples](#examples)
|
|
84
91
|
- [Examples using Selenium](#examples-using-selenium)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
- [Useful articles](#useful-articles)
|
|
93
|
+
- [Get in touch](#get-in-touch)
|
|
94
|
+
- [Join the team 👪](#join-the-team-)
|
|
95
|
+
- [License](#license)
|
|
96
|
+
- [Graphics and Trademarks](#graphics-and-trademarks)
|
|
90
97
|
|
|
91
98
|
## Installation
|
|
92
99
|
|
|
@@ -106,6 +113,18 @@ from twocaptcha import TwoCaptcha
|
|
|
106
113
|
|
|
107
114
|
solver = TwoCaptcha('YOUR_API_KEY')
|
|
108
115
|
```
|
|
116
|
+
|
|
117
|
+
<details>
|
|
118
|
+
<summary>Async</summary>
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from twocaptcha import AsyncTwoCaptcha
|
|
122
|
+
|
|
123
|
+
solver = AsyncTwoCaptcha('YOUR_API_KEY')
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
</details>
|
|
127
|
+
|
|
109
128
|
Also, there are a few options that can be configured:
|
|
110
129
|
|
|
111
130
|
```python
|
|
@@ -458,6 +477,60 @@ result = solver.datadome(captcha_url="https://geo.captcha-delivery.com/captcha/?
|
|
|
458
477
|
param1=..., ...)
|
|
459
478
|
```
|
|
460
479
|
|
|
480
|
+
### VKImage
|
|
481
|
+
|
|
482
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>
|
|
483
|
+
|
|
484
|
+
This method can be used to solve VK captcha using graphical captcha. Returns the number of steps and solution value in the target site's API format.
|
|
485
|
+
|
|
486
|
+
```python
|
|
487
|
+
result = solver.vkimage('path/to/captcha.jpg', steps='[5,4,7,7,14,22,8,...]', ...)
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### VKCaptcha
|
|
491
|
+
|
|
492
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>
|
|
493
|
+
|
|
494
|
+
This method can be used to solve VK Captcha using a token. Returns a token.
|
|
495
|
+
|
|
496
|
+
> [!IMPORTANT]
|
|
497
|
+
> To solve the VK Captcha, you must use a proxy. It is recommended to use [residential proxies].
|
|
498
|
+
|
|
499
|
+
```python
|
|
500
|
+
result = solver.vkcaptcha(redirect_uri='https://id.vk.ru/...',
|
|
501
|
+
userAgent='Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36..',
|
|
502
|
+
proxy={
|
|
503
|
+
'type': 'HTTP',
|
|
504
|
+
'uri': 'login:password@IP_address:PORT'}
|
|
505
|
+
)
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
### CaptchaFox
|
|
509
|
+
|
|
510
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#captchafox)</sup>
|
|
511
|
+
|
|
512
|
+
This method can be used to solve CaptchaFox using a token. Returns a token.
|
|
513
|
+
|
|
514
|
+
```python
|
|
515
|
+
result = solver.captchafox(sitekey='sk_ILKWNruBBVKDOM7dZs59KHnDLEWiH',
|
|
516
|
+
pageurl='https://mysite.com/page/with/captchafox',
|
|
517
|
+
userAgent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',
|
|
518
|
+
proxy={'type': 'HTTPS',
|
|
519
|
+
'uri': 'login:password@IP_address:PORT'})
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
### Prosopo
|
|
523
|
+
|
|
524
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#prosopo-procaptcha)</sup>
|
|
525
|
+
|
|
526
|
+
This method can be used to solve Prosopo captcha using a token. Returns a token.
|
|
527
|
+
|
|
528
|
+
```python
|
|
529
|
+
result = solver.prosopo(sitekey='5EZVvsHMrKCFKp5NYNoTyDjTjetoVo1Z4UNNb1DkVLS0JbqR',
|
|
530
|
+
pageurl='https://mysite.com/page/with/prosopo'
|
|
531
|
+
)
|
|
532
|
+
```
|
|
533
|
+
|
|
461
534
|
### CyberSiARA
|
|
462
535
|
|
|
463
536
|
<sup>[API method description.](https://2captcha.com/2captcha-api#cybersiara)</sup>
|
|
@@ -547,7 +620,55 @@ proxy={
|
|
|
547
620
|
```
|
|
548
621
|
|
|
549
622
|
## Async calls
|
|
550
|
-
|
|
623
|
+
|
|
624
|
+
To use the async version, just replace `TwoCaptcha` with `AsyncTwoCaptcha`:
|
|
625
|
+
|
|
626
|
+
```python
|
|
627
|
+
import asyncio
|
|
628
|
+
from twocaptcha import AsyncTwoCaptcha
|
|
629
|
+
|
|
630
|
+
async def solve_captcha():
|
|
631
|
+
solver = AsyncTwoCaptcha('YOUR_API_KEY')
|
|
632
|
+
|
|
633
|
+
try:
|
|
634
|
+
recaptcha_result = await solver.recaptcha(...)
|
|
635
|
+
return recaptcha_result
|
|
636
|
+
except Exception as e:
|
|
637
|
+
print(e)
|
|
638
|
+
return None
|
|
639
|
+
|
|
640
|
+
if __name__ == '__main__':
|
|
641
|
+
result = asyncio.run(solve_captcha())
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
The `AsyncTwoCaptcha` class supports all the same methods and parameters as the synchronous `TwoCaptcha` class but operates asynchronously. Configuration is identical.
|
|
645
|
+
|
|
646
|
+
### Solving Multiple Captchas in Parallel
|
|
647
|
+
|
|
648
|
+
One of the main advantages of using async support is the ability to solve multiple captchas concurrently:
|
|
649
|
+
|
|
650
|
+
```python
|
|
651
|
+
async def solve_multiple_captchas():
|
|
652
|
+
solver = AsyncTwoCaptcha('YOUR_API_KEY')
|
|
653
|
+
|
|
654
|
+
# Start all tasks simultaneously
|
|
655
|
+
task1 = asyncio.create_task(solver.text('What color is the sky on a clear day?'))
|
|
656
|
+
task2 = asyncio.create_task(solver.text('What is 2+2?'))
|
|
657
|
+
task3 = asyncio.create_task(solver.text('Name of the planet we live on?'))
|
|
658
|
+
|
|
659
|
+
# Wait for all tasks to complete
|
|
660
|
+
results = await asyncio.gather(task1, task2, task3, return_exceptions=True)
|
|
661
|
+
return results
|
|
662
|
+
|
|
663
|
+
# This completes much faster than solving captchas sequentially
|
|
664
|
+
results = asyncio.run(solve_multiple_captchas())
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
Examples of solving all supported captcha types asynchronously are located in the [examples/async directory] directory.
|
|
668
|
+
|
|
669
|
+
### Legacy Async Method
|
|
670
|
+
|
|
671
|
+
For backward compatibility, you can also use the traditional executor-based approach with the synchronous client:
|
|
551
672
|
|
|
552
673
|
```python
|
|
553
674
|
import asyncio
|
|
@@ -565,6 +686,7 @@ async def captchaSolver(image):
|
|
|
565
686
|
|
|
566
687
|
captcha_result = asyncio.run(captchaSolver(image))
|
|
567
688
|
```
|
|
689
|
+
|
|
568
690
|
## Examples
|
|
569
691
|
Examples of solving all supported captcha types are located in the [examples] directory.
|
|
570
692
|
|
|
@@ -604,6 +726,8 @@ The graphics and trademarks included in this repository are not covered by the M
|
|
|
604
726
|
[post options]: https://2captcha.com/2captcha-api#normal_post
|
|
605
727
|
[list of supported languages]: https://2captcha.com/2captcha-api#language
|
|
606
728
|
[examples directory]: /examples
|
|
729
|
+
[examples/sync directory]: /examples/sync
|
|
730
|
+
[examples/async directory]: /examples/async
|
|
607
731
|
[asyncio]: https://docs.python.org/3/library/asyncio.html
|
|
608
732
|
[Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
|
|
609
733
|
[Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
2captcha_python.egg-info/PKG-INFO
|
|
5
|
+
2captcha_python.egg-info/SOURCES.txt
|
|
6
|
+
2captcha_python.egg-info/dependency_links.txt
|
|
7
|
+
2captcha_python.egg-info/requires.txt
|
|
8
|
+
2captcha_python.egg-info/top_level.txt
|
|
9
|
+
twocaptcha/__init__.py
|
|
10
|
+
twocaptcha/api.py
|
|
11
|
+
twocaptcha/async_api.py
|
|
12
|
+
twocaptcha/async_solver.py
|
|
13
|
+
twocaptcha/solver.py
|
|
14
|
+
twocaptcha/exceptions/__init__.py
|
|
15
|
+
twocaptcha/exceptions/api.py
|
|
16
|
+
twocaptcha/exceptions/solver.py
|
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: 2captcha-python
|
|
3
|
+
Version: 2.0.1
|
|
4
|
+
Summary: Python module for easy integration with 2Captcha API
|
|
5
|
+
Home-page: https://github.com/2captcha/2captcha-python/
|
|
6
|
+
Author: 2Captcha
|
|
7
|
+
Author-email: info@2captcha.com
|
|
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,VK Captcha,CaptchaFox,Prosopo,cybersiara
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
14
|
+
Classifier: Topic :: Utilities
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Requires-Python: >=3.8
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: requests
|
|
20
|
+
Requires-Dist: httpx
|
|
21
|
+
Requires-Dist: aiofiles
|
|
22
|
+
Dynamic: author
|
|
23
|
+
Dynamic: author-email
|
|
24
|
+
Dynamic: classifier
|
|
25
|
+
Dynamic: description
|
|
26
|
+
Dynamic: description-content-type
|
|
27
|
+
Dynamic: home-page
|
|
28
|
+
Dynamic: keywords
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
Dynamic: requires-dist
|
|
31
|
+
Dynamic: requires-python
|
|
32
|
+
Dynamic: summary
|
|
33
|
+
|
|
1
34
|
<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>
|
|
2
35
|
<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>
|
|
3
36
|
<a href="https://github.com/2captcha/2captcha-go"><img src="https://github.com/user-attachments/assets/ab22182e-6cb2-41fa-91f4-d5e89c6d7c6f" width="63" height="30"></a>
|
|
@@ -42,6 +75,10 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
42
75
|
- [Cutcaptcha](#cutcaptcha)
|
|
43
76
|
- [Tencent](#tencent)
|
|
44
77
|
- [DataDome](#datadome)
|
|
78
|
+
- [VKImage](#vkimage)
|
|
79
|
+
- [VKCaptcha](#vkcaptcha)
|
|
80
|
+
- [CaptchaFox](#captchafox)
|
|
81
|
+
- [Prosopo](#prosopo)
|
|
45
82
|
- [CyberSiARA](#cybersiara)
|
|
46
83
|
- [Other methods](#other-methods)
|
|
47
84
|
- [send / get\_result](#send--get_result)
|
|
@@ -52,11 +89,11 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
52
89
|
- [Async calls](#async-calls)
|
|
53
90
|
- [Examples](#examples)
|
|
54
91
|
- [Examples using Selenium](#examples-using-selenium)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
92
|
+
- [Useful articles](#useful-articles)
|
|
93
|
+
- [Get in touch](#get-in-touch)
|
|
94
|
+
- [Join the team 👪](#join-the-team-)
|
|
95
|
+
- [License](#license)
|
|
96
|
+
- [Graphics and Trademarks](#graphics-and-trademarks)
|
|
60
97
|
|
|
61
98
|
## Installation
|
|
62
99
|
|
|
@@ -76,6 +113,18 @@ from twocaptcha import TwoCaptcha
|
|
|
76
113
|
|
|
77
114
|
solver = TwoCaptcha('YOUR_API_KEY')
|
|
78
115
|
```
|
|
116
|
+
|
|
117
|
+
<details>
|
|
118
|
+
<summary>Async</summary>
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from twocaptcha import AsyncTwoCaptcha
|
|
122
|
+
|
|
123
|
+
solver = AsyncTwoCaptcha('YOUR_API_KEY')
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
</details>
|
|
127
|
+
|
|
79
128
|
Also, there are a few options that can be configured:
|
|
80
129
|
|
|
81
130
|
```python
|
|
@@ -428,6 +477,60 @@ result = solver.datadome(captcha_url="https://geo.captcha-delivery.com/captcha/?
|
|
|
428
477
|
param1=..., ...)
|
|
429
478
|
```
|
|
430
479
|
|
|
480
|
+
### VKImage
|
|
481
|
+
|
|
482
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>
|
|
483
|
+
|
|
484
|
+
This method can be used to solve VK captcha using graphical captcha. Returns the number of steps and solution value in the target site's API format.
|
|
485
|
+
|
|
486
|
+
```python
|
|
487
|
+
result = solver.vkimage('path/to/captcha.jpg', steps='[5,4,7,7,14,22,8,...]', ...)
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### VKCaptcha
|
|
491
|
+
|
|
492
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>
|
|
493
|
+
|
|
494
|
+
This method can be used to solve VK Captcha using a token. Returns a token.
|
|
495
|
+
|
|
496
|
+
> [!IMPORTANT]
|
|
497
|
+
> To solve the VK Captcha, you must use a proxy. It is recommended to use [residential proxies].
|
|
498
|
+
|
|
499
|
+
```python
|
|
500
|
+
result = solver.vkcaptcha(redirect_uri='https://id.vk.ru/...',
|
|
501
|
+
userAgent='Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36..',
|
|
502
|
+
proxy={
|
|
503
|
+
'type': 'HTTP',
|
|
504
|
+
'uri': 'login:password@IP_address:PORT'}
|
|
505
|
+
)
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
### CaptchaFox
|
|
509
|
+
|
|
510
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#captchafox)</sup>
|
|
511
|
+
|
|
512
|
+
This method can be used to solve CaptchaFox using a token. Returns a token.
|
|
513
|
+
|
|
514
|
+
```python
|
|
515
|
+
result = solver.captchafox(sitekey='sk_ILKWNruBBVKDOM7dZs59KHnDLEWiH',
|
|
516
|
+
pageurl='https://mysite.com/page/with/captchafox',
|
|
517
|
+
userAgent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',
|
|
518
|
+
proxy={'type': 'HTTPS',
|
|
519
|
+
'uri': 'login:password@IP_address:PORT'})
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
### Prosopo
|
|
523
|
+
|
|
524
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#prosopo-procaptcha)</sup>
|
|
525
|
+
|
|
526
|
+
This method can be used to solve Prosopo captcha using a token. Returns a token.
|
|
527
|
+
|
|
528
|
+
```python
|
|
529
|
+
result = solver.prosopo(sitekey='5EZVvsHMrKCFKp5NYNoTyDjTjetoVo1Z4UNNb1DkVLS0JbqR',
|
|
530
|
+
pageurl='https://mysite.com/page/with/prosopo'
|
|
531
|
+
)
|
|
532
|
+
```
|
|
533
|
+
|
|
431
534
|
### CyberSiARA
|
|
432
535
|
|
|
433
536
|
<sup>[API method description.](https://2captcha.com/2captcha-api#cybersiara)</sup>
|
|
@@ -517,7 +620,55 @@ proxy={
|
|
|
517
620
|
```
|
|
518
621
|
|
|
519
622
|
## Async calls
|
|
520
|
-
|
|
623
|
+
|
|
624
|
+
To use the async version, just replace `TwoCaptcha` with `AsyncTwoCaptcha`:
|
|
625
|
+
|
|
626
|
+
```python
|
|
627
|
+
import asyncio
|
|
628
|
+
from twocaptcha import AsyncTwoCaptcha
|
|
629
|
+
|
|
630
|
+
async def solve_captcha():
|
|
631
|
+
solver = AsyncTwoCaptcha('YOUR_API_KEY')
|
|
632
|
+
|
|
633
|
+
try:
|
|
634
|
+
recaptcha_result = await solver.recaptcha(...)
|
|
635
|
+
return recaptcha_result
|
|
636
|
+
except Exception as e:
|
|
637
|
+
print(e)
|
|
638
|
+
return None
|
|
639
|
+
|
|
640
|
+
if __name__ == '__main__':
|
|
641
|
+
result = asyncio.run(solve_captcha())
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
The `AsyncTwoCaptcha` class supports all the same methods and parameters as the synchronous `TwoCaptcha` class but operates asynchronously. Configuration is identical.
|
|
645
|
+
|
|
646
|
+
### Solving Multiple Captchas in Parallel
|
|
647
|
+
|
|
648
|
+
One of the main advantages of using async support is the ability to solve multiple captchas concurrently:
|
|
649
|
+
|
|
650
|
+
```python
|
|
651
|
+
async def solve_multiple_captchas():
|
|
652
|
+
solver = AsyncTwoCaptcha('YOUR_API_KEY')
|
|
653
|
+
|
|
654
|
+
# Start all tasks simultaneously
|
|
655
|
+
task1 = asyncio.create_task(solver.text('What color is the sky on a clear day?'))
|
|
656
|
+
task2 = asyncio.create_task(solver.text('What is 2+2?'))
|
|
657
|
+
task3 = asyncio.create_task(solver.text('Name of the planet we live on?'))
|
|
658
|
+
|
|
659
|
+
# Wait for all tasks to complete
|
|
660
|
+
results = await asyncio.gather(task1, task2, task3, return_exceptions=True)
|
|
661
|
+
return results
|
|
662
|
+
|
|
663
|
+
# This completes much faster than solving captchas sequentially
|
|
664
|
+
results = asyncio.run(solve_multiple_captchas())
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
Examples of solving all supported captcha types asynchronously are located in the [examples/async directory] directory.
|
|
668
|
+
|
|
669
|
+
### Legacy Async Method
|
|
670
|
+
|
|
671
|
+
For backward compatibility, you can also use the traditional executor-based approach with the synchronous client:
|
|
521
672
|
|
|
522
673
|
```python
|
|
523
674
|
import asyncio
|
|
@@ -535,6 +686,7 @@ async def captchaSolver(image):
|
|
|
535
686
|
|
|
536
687
|
captcha_result = asyncio.run(captchaSolver(image))
|
|
537
688
|
```
|
|
689
|
+
|
|
538
690
|
## Examples
|
|
539
691
|
Examples of solving all supported captcha types are located in the [examples] directory.
|
|
540
692
|
|
|
@@ -574,6 +726,8 @@ The graphics and trademarks included in this repository are not covered by the M
|
|
|
574
726
|
[post options]: https://2captcha.com/2captcha-api#normal_post
|
|
575
727
|
[list of supported languages]: https://2captcha.com/2captcha-api#language
|
|
576
728
|
[examples directory]: /examples
|
|
729
|
+
[examples/sync directory]: /examples/sync
|
|
730
|
+
[examples/async directory]: /examples/async
|
|
577
731
|
[asyncio]: https://docs.python.org/3/library/asyncio.html
|
|
578
732
|
[Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
|
|
579
733
|
[Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
|
|
@@ -1,33 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: 2captcha-python
|
|
3
|
-
Version: 1.5.1
|
|
4
|
-
Summary: Python module for easy integration with 2Captcha API
|
|
5
|
-
Home-page: https://github.com/2captcha/2captcha-python/
|
|
6
|
-
Author: 2Captcha
|
|
7
|
-
Author-email: info@2captcha.com
|
|
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
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
13
|
-
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
14
|
-
Classifier: Topic :: Utilities
|
|
15
|
-
Classifier: Intended Audience :: Developers
|
|
16
|
-
Requires-Python: >=3.6
|
|
17
|
-
Description-Content-Type: text/markdown
|
|
18
|
-
License-File: LICENSE
|
|
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
|
|
30
|
-
|
|
31
1
|
<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>
|
|
32
2
|
<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>
|
|
33
3
|
<a href="https://github.com/2captcha/2captcha-go"><img src="https://github.com/user-attachments/assets/ab22182e-6cb2-41fa-91f4-d5e89c6d7c6f" width="63" height="30"></a>
|
|
@@ -72,6 +42,10 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
72
42
|
- [Cutcaptcha](#cutcaptcha)
|
|
73
43
|
- [Tencent](#tencent)
|
|
74
44
|
- [DataDome](#datadome)
|
|
45
|
+
- [VKImage](#vkimage)
|
|
46
|
+
- [VKCaptcha](#vkcaptcha)
|
|
47
|
+
- [CaptchaFox](#captchafox)
|
|
48
|
+
- [Prosopo](#prosopo)
|
|
75
49
|
- [CyberSiARA](#cybersiara)
|
|
76
50
|
- [Other methods](#other-methods)
|
|
77
51
|
- [send / get\_result](#send--get_result)
|
|
@@ -82,11 +56,11 @@ Examples of API requests for different captcha types are available on the [Pytho
|
|
|
82
56
|
- [Async calls](#async-calls)
|
|
83
57
|
- [Examples](#examples)
|
|
84
58
|
- [Examples using Selenium](#examples-using-selenium)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
59
|
+
- [Useful articles](#useful-articles)
|
|
60
|
+
- [Get in touch](#get-in-touch)
|
|
61
|
+
- [Join the team 👪](#join-the-team-)
|
|
62
|
+
- [License](#license)
|
|
63
|
+
- [Graphics and Trademarks](#graphics-and-trademarks)
|
|
90
64
|
|
|
91
65
|
## Installation
|
|
92
66
|
|
|
@@ -106,6 +80,18 @@ from twocaptcha import TwoCaptcha
|
|
|
106
80
|
|
|
107
81
|
solver = TwoCaptcha('YOUR_API_KEY')
|
|
108
82
|
```
|
|
83
|
+
|
|
84
|
+
<details>
|
|
85
|
+
<summary>Async</summary>
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from twocaptcha import AsyncTwoCaptcha
|
|
89
|
+
|
|
90
|
+
solver = AsyncTwoCaptcha('YOUR_API_KEY')
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
</details>
|
|
94
|
+
|
|
109
95
|
Also, there are a few options that can be configured:
|
|
110
96
|
|
|
111
97
|
```python
|
|
@@ -458,6 +444,60 @@ result = solver.datadome(captcha_url="https://geo.captcha-delivery.com/captcha/?
|
|
|
458
444
|
param1=..., ...)
|
|
459
445
|
```
|
|
460
446
|
|
|
447
|
+
### VKImage
|
|
448
|
+
|
|
449
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>
|
|
450
|
+
|
|
451
|
+
This method can be used to solve VK captcha using graphical captcha. Returns the number of steps and solution value in the target site's API format.
|
|
452
|
+
|
|
453
|
+
```python
|
|
454
|
+
result = solver.vkimage('path/to/captcha.jpg', steps='[5,4,7,7,14,22,8,...]', ...)
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### VKCaptcha
|
|
458
|
+
|
|
459
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>
|
|
460
|
+
|
|
461
|
+
This method can be used to solve VK Captcha using a token. Returns a token.
|
|
462
|
+
|
|
463
|
+
> [!IMPORTANT]
|
|
464
|
+
> To solve the VK Captcha, you must use a proxy. It is recommended to use [residential proxies].
|
|
465
|
+
|
|
466
|
+
```python
|
|
467
|
+
result = solver.vkcaptcha(redirect_uri='https://id.vk.ru/...',
|
|
468
|
+
userAgent='Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36..',
|
|
469
|
+
proxy={
|
|
470
|
+
'type': 'HTTP',
|
|
471
|
+
'uri': 'login:password@IP_address:PORT'}
|
|
472
|
+
)
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
### CaptchaFox
|
|
476
|
+
|
|
477
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#captchafox)</sup>
|
|
478
|
+
|
|
479
|
+
This method can be used to solve CaptchaFox using a token. Returns a token.
|
|
480
|
+
|
|
481
|
+
```python
|
|
482
|
+
result = solver.captchafox(sitekey='sk_ILKWNruBBVKDOM7dZs59KHnDLEWiH',
|
|
483
|
+
pageurl='https://mysite.com/page/with/captchafox',
|
|
484
|
+
userAgent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',
|
|
485
|
+
proxy={'type': 'HTTPS',
|
|
486
|
+
'uri': 'login:password@IP_address:PORT'})
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### Prosopo
|
|
490
|
+
|
|
491
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#prosopo-procaptcha)</sup>
|
|
492
|
+
|
|
493
|
+
This method can be used to solve Prosopo captcha using a token. Returns a token.
|
|
494
|
+
|
|
495
|
+
```python
|
|
496
|
+
result = solver.prosopo(sitekey='5EZVvsHMrKCFKp5NYNoTyDjTjetoVo1Z4UNNb1DkVLS0JbqR',
|
|
497
|
+
pageurl='https://mysite.com/page/with/prosopo'
|
|
498
|
+
)
|
|
499
|
+
```
|
|
500
|
+
|
|
461
501
|
### CyberSiARA
|
|
462
502
|
|
|
463
503
|
<sup>[API method description.](https://2captcha.com/2captcha-api#cybersiara)</sup>
|
|
@@ -547,7 +587,55 @@ proxy={
|
|
|
547
587
|
```
|
|
548
588
|
|
|
549
589
|
## Async calls
|
|
550
|
-
|
|
590
|
+
|
|
591
|
+
To use the async version, just replace `TwoCaptcha` with `AsyncTwoCaptcha`:
|
|
592
|
+
|
|
593
|
+
```python
|
|
594
|
+
import asyncio
|
|
595
|
+
from twocaptcha import AsyncTwoCaptcha
|
|
596
|
+
|
|
597
|
+
async def solve_captcha():
|
|
598
|
+
solver = AsyncTwoCaptcha('YOUR_API_KEY')
|
|
599
|
+
|
|
600
|
+
try:
|
|
601
|
+
recaptcha_result = await solver.recaptcha(...)
|
|
602
|
+
return recaptcha_result
|
|
603
|
+
except Exception as e:
|
|
604
|
+
print(e)
|
|
605
|
+
return None
|
|
606
|
+
|
|
607
|
+
if __name__ == '__main__':
|
|
608
|
+
result = asyncio.run(solve_captcha())
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
The `AsyncTwoCaptcha` class supports all the same methods and parameters as the synchronous `TwoCaptcha` class but operates asynchronously. Configuration is identical.
|
|
612
|
+
|
|
613
|
+
### Solving Multiple Captchas in Parallel
|
|
614
|
+
|
|
615
|
+
One of the main advantages of using async support is the ability to solve multiple captchas concurrently:
|
|
616
|
+
|
|
617
|
+
```python
|
|
618
|
+
async def solve_multiple_captchas():
|
|
619
|
+
solver = AsyncTwoCaptcha('YOUR_API_KEY')
|
|
620
|
+
|
|
621
|
+
# Start all tasks simultaneously
|
|
622
|
+
task1 = asyncio.create_task(solver.text('What color is the sky on a clear day?'))
|
|
623
|
+
task2 = asyncio.create_task(solver.text('What is 2+2?'))
|
|
624
|
+
task3 = asyncio.create_task(solver.text('Name of the planet we live on?'))
|
|
625
|
+
|
|
626
|
+
# Wait for all tasks to complete
|
|
627
|
+
results = await asyncio.gather(task1, task2, task3, return_exceptions=True)
|
|
628
|
+
return results
|
|
629
|
+
|
|
630
|
+
# This completes much faster than solving captchas sequentially
|
|
631
|
+
results = asyncio.run(solve_multiple_captchas())
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
Examples of solving all supported captcha types asynchronously are located in the [examples/async directory] directory.
|
|
635
|
+
|
|
636
|
+
### Legacy Async Method
|
|
637
|
+
|
|
638
|
+
For backward compatibility, you can also use the traditional executor-based approach with the synchronous client:
|
|
551
639
|
|
|
552
640
|
```python
|
|
553
641
|
import asyncio
|
|
@@ -565,6 +653,7 @@ async def captchaSolver(image):
|
|
|
565
653
|
|
|
566
654
|
captcha_result = asyncio.run(captchaSolver(image))
|
|
567
655
|
```
|
|
656
|
+
|
|
568
657
|
## Examples
|
|
569
658
|
Examples of solving all supported captcha types are located in the [examples] directory.
|
|
570
659
|
|
|
@@ -604,6 +693,8 @@ The graphics and trademarks included in this repository are not covered by the M
|
|
|
604
693
|
[post options]: https://2captcha.com/2captcha-api#normal_post
|
|
605
694
|
[list of supported languages]: https://2captcha.com/2captcha-api#language
|
|
606
695
|
[examples directory]: /examples
|
|
696
|
+
[examples/sync directory]: /examples/sync
|
|
697
|
+
[examples/async directory]: /examples/async
|
|
607
698
|
[asyncio]: https://docs.python.org/3/library/asyncio.html
|
|
608
699
|
[Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
|
|
609
700
|
[Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
|