Rucaptcha Api Python

#1
1655818351557.png

This is a new lightweight library for easy interaction with the RuCaptcha captcha solution server.

Code:
Code:
from rucaptcha import RuCaptchaConnection

connection = RuCaptchaConnection(token='')        
captcha_file = open('./captcha.png', 'rb')
captcha = connection.send(captcha_file)
decision = captcha.wait_decision()

print(f"Successfully decided: {decision}")
Feature List:
1655818374295.png

Possible exceptions:
  • Errors of the RuCaptcha service when sending a captcha: documentation
  • Errors of the RuCaptcha service when receiving captcha: documentation
  • Library errors:
    • [HTTP CODE] Could not connect to RuCatcha server! - the server returned a code other than 200 OK
    • Timeout waiting decision - the captcha decision timeout limit has been exceeded
Examples of working with the library:
Sending and waiting for a captcha solution
Code:
from rucaptcha import RuCaptchaConnection

connection = RuCaptchaConnection(token='')        
captcha_file = open('./captcha.png', 'rb')
captcha = connection.send(captcha_file)
decision = captcha.wait_decision()

print(f"Successfully decided: {decision}")
Sending and alternatively waiting for a captcha solution
Code:
from rucaptcha import RuCaptchaConnection
import time

connection = RuCaptchaConnection(token='')        
captcha_file = open('./captcha.png', 'rb')
captcha = connection.send(captcha_file)
while True:
  if(captcha.captcha_ready()):
    decision = captcha.get_decision()
    break
  time.sleep(5)

print(f"Successfully decided: {decision}")
Getting balance on the service
Code:
from rucaptcha import RuCaptchaConnection

connection = RuCaptchaConnection(token='')
balance = connection.get_balance()
print(f"Your balance: {balance} RUB")
Documentation https://github.com/aveBHS/rucaptcha-api-python