Create a pool in a project in Toloka.
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');
First, specify the parameters you want your pool to have. In this example, we use the following pool settings:
You can choose your own values or have your own set of the pool parameters. Refer to the Pool class page for more details.
from datetime import datetime
new_pool = toloka.pool.Pool(
project_id='83859',
private_name='First pool',
may_contain_adult_content=False,
will_expire=datetime(2030, 1, 1),
reward_per_assignment=0.05,
assignment_max_duration_seconds=60*5,
auto_accept_solutions=False,
defaults=toloka.pool.Pool.Defaults(default_overlap_for_new_task_suites=1)
)
All the code manipulations at step 3 occur in your device memory. The data will only be sent to the server after calling the create_pool()
method at step 4.
This actually creates a pool in Toloka.
new_pool = toloka_client.create_pool(new_pool)
The create_pool()
request will return the Pool class object. You can use its attributes to print the information you need.
print(new_pool.id)
You should get an output with the created pool ID which looks like this.
1440972
import toloka.client as tolokafrom datetime import datetimetoloka_client = toloka.TolokaClient('PlaceYourRealApiKey_Here', 'PRODUCTION')new_pool = toloka.pool.Pool( project_id='83859', private_name='First pool', may_contain_adult_content=False, will_expire=datetime(2030, 1, 1), reward_per_assignment=0.05, assignment_max_duration_seconds=60*5, auto_accept_solutions=False, defaults=toloka.pool.Pool.Defaults(default_overlap_for_new_task_suites=1))new_pool = toloka_client.create_pool(new_pool)print(new_pool.id)
Last updated: February 7, 2023