Reject responses from Tolokers

Reject Toloker responses with the IDs specified in the request.

Steps to follow

1. Import Toloka-Kit

Connect the Toloka-Kit library to your script.

import toloka.client as toloka

2. Instantiate TolokaClient

Replace the sample API key with your own one.

toloka_client = toloka.
TolokaClient
('PlaceYourRealApiKey_Here', 'PRODUCTION');

3. Reject Toloker response

Find out the ID of the Toloker response that your want to reject and use the reject_assignment() method to reject the response and leave a comment.

rejected_assignment = toloka_client.
reject_assignment
('0001d38f5b--61c8be2074fdb82592f97887', 'The answer is not clear')

The Toloker response will be marked as rejected with the The answer is not clear comment added to it.

4. Print Toloker response status and public comment

The reject_assignment() request will return the Assignment class object. You can use its attributes to print the information you need.

print(rejected_assignment.status, rejected_assignment.public_comment)

You should get an output with the updated Toloker response status and public comment which looks like this.

Status.REJECTED The answer is not clear

Complete code: Reject responses from Tolokers

import toloka.client as toloka
toloka_client = toloka.TolokaClient('PlaceYourRealApiKey_Here', 'PRODUCTION')
rejected_assignment = toloka_client.reject_assignment('0001d38f5b--61c8be2074fdb82592f97887', 'The answer is not clear')
print(rejected_assignment.status, rejected_assignment.public_comment)
List of classes and methods used in this recipe

See also

Last updated: February 7, 2023

Toloka-Kit
OverviewGetting API keyQuick start
Recipes
Reference
toloka.client
toloka.async_client
toloka.autoquality [autoquality]
toloka.metrics
toloka.streaming