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 image CAPTCHAS and reCAPTCHAs are supported.
Installation
pip install imagetyperz-async
Usage
import asyncio
from imagetyperz import ImageTyperzClient, reCAPTCHAType
from imagetyperz.exceptions import NotDecoded
async def demo():
###
# Context manager will handle the closing of connections in the underlying
# httpx AsyncClient at block end.
#
# Alternatively, `await ita.aclose()` may be manually called to perform
# cleanup.
#
# If no cleanup is performed, a warning may be emitted at Python exit.
#
async with ImageTyperzClient('6F0848592604C9E14F0EBEA7368493C5') as ita:
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...
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
File details
Details for the file imagetyperz_async-0.3.2.tar.gz
.
File metadata
- Download URL: imagetyperz_async-0.3.2.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.11.1 Linux/5.13.0-52-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39726de75af0b472adf497870f3df873ee2349c0dc4933a6a849bb4d5b4abae2 |
|
MD5 | d0b00c4a5fd4347aa3e986ebb4a50dd3 |
|
BLAKE2b-256 | 7525814eb36d328fd30e3a6d7e06fcea4beefa0b80ca565d2d2d426e52bd5783 |
File details
Details for the file imagetyperz_async-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: imagetyperz_async-0.3.2-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.11.1 Linux/5.13.0-52-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0d055a70d2629bcf1916c09e441a4ce416381af929317a658a498e754d7a001 |
|
MD5 | e05f7b919fa7e34d22420d03d32e25da |
|
BLAKE2b-256 | 1d0ede3047bfac8d911a7011a01344f000fd0b5128cf6aa11765d001cff19206 |