Change pool priority

Change the priority of the pool and offer it to Tolokers before other pools.

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. Change pool priority

Find out the ID of the pool for which you want to change the priority. Then call the patch_pool() method.

patched_pool = toloka_client.
(pool_id='1443815', priority=0)

4. Print pool ID and priority

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

print(patched_pool.id, patched_pool.priority)

You should get an output with the pool ID and the updated priority which looks like this.

1443815 0

Complete code: Change pool priority

import toloka.client as toloka
toloka_client = toloka.TolokaClient('AQC2AGAJgyNSA8CtpdO9MWy_QEB6s6kDjHUoElE', 'PRODUCTION')
patched_pool = toloka_client.patch_pool(pool_id='1443815', priority=0)
print(patched_pool.id, patched_pool.priority)
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