Skip to main content

Python library for hosting and controlling tasks of the Yandex.Toloka service.

Project description

AutoToloka

AutoToloka is a Python library for hosting and controlling tasks of the Yandex.Toloka service

Installation

To install the latest version from PyPI:

pip install -U autotoloka

Getting started

OAuth Token

For authorization, you need to get an OAuth token, you can get it on your Yandex.Toloka profile.

Profile -> External Services Integration -> Get OAuth token

Proxy

If you want to use Yandex.Disk as a storage for your images, then you need a proxy. You can add proxy on your Yandex.Toloka profile.

Profile -> External Services Interation -> Yandex.Disk Integration -> Add Proxy

Example

from autotoloka import TolokaProjectHandler
from autotoloka.json_data import json_data

OAUTH_TOKEN = 'your_token'

PROJECT_CONFIG = json_data['project_name']

POOL_ID = 'pool_id' # ID of the created pool
PROJECT_ID = 'project_id' # ID of the project that the pool was created for
SUITE_ID = 'suite_id' # ID of the created suite

handler = TolokaProjectHandler(OAUTH_TOKEN)


# Creates Toloka project by configuration in a given file
handler.create_toloka_project(PROJECT_CONFIG) 

# Updates the project, obtained by the handler
handler.update_toloka_project(PROJECT_CONFIG) 

# Prints out project parameters
handler.get_project_params() 

# Creates Toloka pool by dictionary-stored or file-based configurations
handler.create_toloka_pool() 

# Updates Toloka pool by given parameters
handler.update_pool(POOL_ID) 

# Prints and returns all available pools' parameters
handler.get_pools_params(less_info=True, only_current_project=True) 

# Opens or closes the required pool
handler.open_close_pool(handler.get_pools_params()) # also you can close pool, then write 'close'

# Creates either a Toloka task or a Toloka task-suite by dictionary-stored input values
input_values = [{'key_1': 'value_1', 'key_2': 'value_2'}, 
                {'key_1': 'value_3', 'key_2': 'value_4'}]
handler.create_task_suite(POOL_ID, input_values) 

# Creates either a Toloka task or a Toloka task-suite with data from Ya.Disk proxy-folder
handler.create_task_suite_from_yadisk_proxy(POOL_ID, OAUTH_TOKEN, 'test-photos/test1/',
                                              tasks_on_suite=1) 

# Prints all available tasks or task-suites in the project
handler.get_toloka_tasks_suites(POOL_ID) 

# Archives the given object by its ID and type
handler.archive_object('project', PROJECT_ID) # also you use archive_object for pools, then you need ('pool', POOL_ID)

# Changes the overlap of either the task or the task-suite, also is able to set infinite overlap
handler.change_task_suite_overlap(SUITE_ID, overlap=1) 

# Sends the signal to stop showing the task-suite by its ID
handler.stop_showing_task_suite(SUITE_ID) 

handler.get_answers(POOL_ID)

Authors

The library created by SHIFTLab CFT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autotoloka-0.0.10.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

autotoloka-0.0.10-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file autotoloka-0.0.10.tar.gz.

File metadata

  • Download URL: autotoloka-0.0.10.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.3

File hashes

Hashes for autotoloka-0.0.10.tar.gz
Algorithm Hash digest
SHA256 f5eda761116f5ee99f70f28f2deb72da2ae355179f84ebfde102bc28d0f40dfc
MD5 62fc871b16a779fb4372d3876520e7b1
BLAKE2b-256 000916fcc6624ffe8fde204e6c63c41ac5c6f7aa809f3c9a6a0a8be2ffde7d10

See more details on using hashes here.

File details

Details for the file autotoloka-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: autotoloka-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.3

File hashes

Hashes for autotoloka-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 bf721d9b3eab0483fa3715e21fc4f05fdf626ce9af55178eb8b63b18c1edaa81
MD5 10a2240e5ca1e50c83cb67c67b525a78
BLAKE2b-256 1991ce7f038d7972662910d17020ba6f18ea38d0126e22fb1257305dd0b27f31

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page