edim24 / aiorucaptcha

RuCaptcha.com клиент для asyncio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RuCaptcha.com клиент для asyncio

Установка:

git clone https://github.com/JeckLabs/aiorucaptcha.git
cd aiorucaptcha && sudo python setup.py install

Использование:

import asyncio
import aiorucaptcha

async def recognize(ocr, filename):
    with open(filename, 'rb') as f:
        captcha = f.read()
        result = await ocr.recognize(captcha)
        print(result)

# Вместо xxx ключ RuCaptcha
ocr = aiorucaptcha.Client('xxx')

loop = asyncio.get_event_loop()
tasks = [
    asyncio.Task(recognize(ocr, 'captcha_a.gif')),
    asyncio.Task(recognize(ocr, 'captcha_b.gif'))]
loop.run_until_complete(asyncio.wait(tasks))
loop.close()

About

RuCaptcha.com клиент для asyncio

License:Apache License 2.0


Languages

Language:Python 100.0%