CAPTCHAFORUM
Administrator
![f65a85c3bc[1].png f65a85c3bc[1].png](https://captchaforum.com/data/attachments/0/938-884d60f9102acc3c7bd16f27b90c043e.jpg)
The easiest way to quickly integrate 2Captcha captcha solving service into your code to automate solving of any types of captcha.
Installation
This package can be installed with Pip:
pip3 install 2captcha-python
Configuration
TwoCaptcha instance can be created like this:
Code:
from twocaptcha import TwoCaptcha
solver = TwoCaptcha('YOUR_API_KEY')
Code:
config = {
'server': '2captcha.com',
'apiKey': 'YOUR_API_KEY',
'softId': 123,
'callback': 'https://your.site/result-receiver',
'defaultTimeout': 120,
'recaptchaTimeout': 600,
'pollingInterval': 10,
}
solver = TwoCaptcha(**config)
Normal Captcha
To bypass a normal captcha (distorted text on image) use the following method. This method also can be used to recognize any text on the image.
result = solver.normal('path/to/captcha.jpg', param1=..., ...)
Text Captcha
This method can be used to bypass a captcha that requires to answer a question provided in clear text.
result = solver.text('If tomorrow is Saturday, what day is today?', param1=..., ...)
ReCaptcha v2
Use this method to solve ReCaptcha V2 and obtain a token to bypass the protection.
result = solver.recaptcha(sitekey='6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
url='https://mysite.com/page/with/recaptcha’,
param1=..., ...)
ReCaptcha v3
This method provides ReCaptcha V3 solver and returns a token.
result = solver.recaptcha(sitekey=’6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-',
url='https://mysite.com/page/with/recaptcha',
version='v3',
param1=..., ...)
Documentation https://github.com/2captcha/2captcha-python