Assign skill to Toloker

Assign an existing skill to Tolokers an 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 OAuth token with your own one.

toloka_client = toloka.
('AQC2AGAJgyNSA8CtpdO9MWy_QEB6s6kDjHUoElE', 'PRODUCTION');

3. Assign skill to Toloker

from decimal import Decimal


user_skill = toloka_client.
(

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('AQC2AGAJgyNSA8CtpdO9MWy_QEB6s6kDjHUoElE', '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

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