Accept responses from Tolokers

Accept 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 OAuth token with your own one.

toloka_client = toloka.

3. Accept Toloker response

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

accepted_assignment = toloka_client.
('0001d38f5b--61c8be211c3a7842a596ac0a', 'OK');

The Toloker response will be marked as accepted with the OK comment added to it.

4. Print Toloker response status and public comment

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

print(accepted_assignment.status, accepted_assignment.public_comment)

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


Complete code: Accept responses from Tolokers

import toloka.client as toloka
toloka_client = toloka.TolokaClient('AQC2AGAJgyNSA8CtpdO9MWy_QEB6s6kDjHUoElE', 'PRODUCTION')
accepted_assignment = toloka_client.accept_assignment('0001d38f5b--61c8be211c3a7842a596ac0a', 'OK')
print(accepted_assignment.status, accepted_assignment.public_comment)
List of classes and methods used in this recipe

See also

OverviewGetting OAuth tokenQuick start
toloka.autoquality [autoquality]