Asynchronous client for the ImageTyperz API
Project description
imagetyperz-async
An asynchronous client for the ImageTyperz CAPTCHA-solving API.
httpx powers the HTTP requests.
At the moment, only reCAPTCHAs are supported.
Installation
pip install imagetyperz-async
Usage
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()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for imagetyperz_async-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d364d27d516bba81517bd23a01f8b4787f7e71c2f917ca701e30e866bad13b6 |
|
MD5 | dd1cf990a27163ff957fc9d8be1a9c9a |
|
BLAKE2b-256 | 3ca49b1d99617ac151b9646f2b5689a52b6c3c4d41624c12f0d20f959694d4fc |