
This library implements a simple to use wrapper around the 2Captcha.com API.
Installation
From PyPi
pip install twocaptchaapi
From source
Code:
git clone https://github.com/athre0z/twocaptcha-api.git
cd twocaptcha-api
python setup.py install
Examples
Initializing the API
Code:
from twocaptchaapi import TwoCaptchaApi
api = TwoCaptchaApi('<API KEY>')
Code:
with open('/my/captcha/path.png', 'rb') as captcha_file:
captcha = api.solve(captcha_file)
print(captcha.await_result())
Solve captcha "non-blocking"
Code:
captcha = api.solve(captcha_file)
print(captcha.try_get_result())
Reporting a bad captcha
Code:
result = captcha.await_result()
if use_captcha_code(result) == 'failed':
captcha.report_bad()
print(api.get_balance())
Compatibilty
This library was successfully tested on Python 2.7 and 3.5. Python versions < 2.7 are not officially supported.
Documentation https://github.com/athre0z/twocaptcha-api