Python-Anticaptcha since 0.3.0 supports task type
`CustomCaptchaTask. It allows collects arbitrary description of image.
This type of tasks is suitable for use when you need to describe what is on an image and you need workers to fill a custom form about this.
- Build ML dataset
- Read letters and numbers from a car license plate
- Find a phone number on a commercial
- Reading data from the invoice scan
- Complete task like “count monkeys on a picture”
At the beginning you need to initialize the Anti-captcha.com client:
from python_anticaptcha import AnticaptchaClient api_key = 'xxxx' client = AnticaptchaClient(api_key)
Then you build the form as dict of fields:
from collections import OrderedDict from python_anticaptcha.fields import TextInput, Select form = OrderedDict() form['dot_count'] = TextInput(label="Dot count", labelHint="Enter the number of dots.") form['dot_color'] = Select(label="Dot color", labelHint="Select the color of dots.", choices=[('red', "Red"), ('blue', "Blue"), ('green', "Green")])
The form field key name specifies the name of the answer key.
There is multiple types of form fields, see Fields.
If they do not meet your expectations - use the JSON structure directly. You can use the following to build a proper structure:
- use FormBuilder tool in Anti-Captcha.com clients area.
- code it manually using Anti-captcha.com documentation.
Next to send form & image URL to Anti-captcha.com and receive answer:
url = "https://s.jawne.info.pl/dot_img" task = CustomCaptchaTask(imageUrl=url, assignment="Count the dots and indicate their color.", form=form) job = client.createTask(task) job.join() answer = job.get_answers() print(answer['dot_count'], answer['dot_color'])