Assign an existing skill to Tolokers and set its level.
Connect the Toloka-Kit library to your script.
import toloka.client as toloka
Replace the sample API key with your own one.
toloka_client = toloka.TolokaClient('PlaceYourRealApiKey_Here', 'PRODUCTION');
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)
)
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
import toloka.client as tolokafrom decimal import Decimaltoloka_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)
Last updated: February 7, 2023