def test_serialize(self):
     form = Radio(label="title", labelHint="subtitle", choices=[('value', 'caption'), ])
     self.assertEqual(form.serialize(name="name"), {
         "label": "title",
         "labelHint": "subtitle",
         "name": "name",
         "inputType": "radio",
         "inputOptions": [
             {
                 "value": "value",
                 "caption": "caption"
             }
         ]
     })
Reference: Ticket #16426 of Anti-captcha.com
"""

CHOICES_CONTENT = [('P', 'P**n / Nudity'), ('V', 'Violence'), ('O', 'Other')]
URLS = [
    "https://s.jawne.info.pl/captcha-nude",
    "https://s.jawne.info.pl/captcha-violence",
    "https://s.jawne.info.pl/captcha-mona-lisa"
]

RESULTS = ['P', 'V', 'O']

form = {
    'content':
    Radio(label="Content classification",
          labelHint="What is visible in the picture?",
          choices=CHOICES_CONTENT)
}


def build_jobs(urls):
    client = AnticaptchaClient(api_key)
    tasks = [
        CustomCaptchaTask(imageUrl=url,
                          assignment="Content moderation",
                          form=form) for url in urls
    ]
    return [client.createTask(task) for task in tasks]


def process_bulk(urls):
Пример #3
0
                   ('UA', 'Ukraine'), ('CA', 'Canada'), ('Other', 'Other')]

CHOICES_GENRE = [('M', 'Male'), ('F', 'Female'), ('O', 'Other')]

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=CHOICES)

form['country'] = Select(label="Your country",
                         labelHint="Select your country of origin",
                         choices=CHOICES_COUNTRY)
form['genre'] = Radio(label="Your genre",
                      labelHint="Select your genre",
                      choices=CHOICES_GENRE)


def process(url):
    client = AnticaptchaClient(api_key)
    task = CustomCaptchaTask(
        imageUrl=url,
        assignment="Count the dots and indicate their color.",
        form=form)

    job = client.createTask(task)
    job.join()
    answer = job.get_answers()
    return answer['dot_count'], answer['dot_color']