Assign skill to Toloker

Assign an existing skill to Tolokers and set its level.

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. Assign skill to Toloker

Find out the ID of the skill which you want to assign. Then assign the skill to the Toloker with the ID specified in the request.

from decimal import Decimal


user_skill = toloka_client.
set_user_skill
(

user_id='1ad097faba0eff85a04fe30bc04d53db',

skill_id='11051', value=Decimal(50)

)

4. Print created skill information

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

print(user_skill.id, user_skill.skill_id, user_skill.user_id, user_skill.value)

You should get an output with the ID of the skill-Toloker pair (this allows removing skills from Tolokers later), assigned skill ID, Toloker ID, and the skill level the Toloker received which looks like this.

54132692 12648 1ad097faba0eff85a04fe30bc04d53db 50

Complete code: Create skill

import toloka.client as toloka
from decimal import Decimal
toloka_client = toloka.TolokaClient('PlaceYourRealApiKey_Here', 'PRODUCTION')
user_skill = toloka_client.set_user_skill(
user_id='1ad097faba0eff85a04fe30bc04d53db',
skill_id='12648', value=Decimal(50)
)
print(user_skill.id, user_skill.skill_id, user_skill.user_id, user_skill.value)
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