Metadata-Version: 2.1
Name: imagetyperz-async
Version: 0.1.0
Summary: Asynchronous client for the ImageTyperz API
Home-page: https://github.com/theY4Kman/imagetyperz-async
License: MIT
Keywords: imagetyperz,captcha
Author: Zach "theY4Kman" Kanzler
Author-email: they4kman@gmail.com
Requires-Python: >=3.6,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Dist: httpx (>=0.15.0)
Description-Content-Type: text/markdown

# imagetyperz-async

An asynchronous client for the [ImageTyperz CAPTCHA-solving API](http://imagetyperz.com/).

[httpx](https://github.com/encode/httpx) powers the HTTP requests.

**At the moment, only reCAPTCHAs are supported.**


# Installation

```bash
pip install imagetyperz-async
```


# Usage

```python
import asyncio

from imagetyperz import ImageTyperzClient, reCAPTCHAType
from imagetyperz.exceptions import NotDecoded

async def demo():
    ita = ImageTyperzClient('6F0848592604C9E14F0EBEA7368493C5')

    print(await ita.retrieve_balance())
    #: 8.8325

    # Submit reCAPTCHA job
    job_id = await ita.submit_recaptcha(
        page_url='https://example.com/login',
        site_key='scraped-site-key',
        recaptcha_type=reCAPTCHAType.INVISIBLE,
    )
    print(job_id)
    #: 176140709

    # Check for results of the reCAPTCHA job
    while True:
        try:
            g_response = await ita.retrieve_recaptcha(job_id)
        except NotDecoded:
            await asyncio.sleep(5)
            continue
        else:
            print(g_response)
            #: 03AGdBq25hDTCjOq4QywdrY...
            break

    # Alternatively, use complete_recaptcha to automatically handle the polling
    # for results — returning with the result when ready.
    g_response = await ita.complete_recaptcha(
        page_url='https://example.com/login',
        site_key='scraped-site-key',
        recaptcha_type=reCAPTCHAType.INVISIBLE,
    )
    print(g_response)
    #: 03AGdBq25hDTCjOq4QywdrY...

    # Close our client, to prevent warnings about unclosed httpx client
    await ita.aclose()
```

