Skip to main content

Python client SDK for Tutti.ai

Installation

pip install tutti-client

Importing Module

from tutti_client import TuttiDuct
duct = TuttiDuct()

Usage

For example, to obtain a list of your Tutti projects:

import asyncio
from tutti_client import TuttiDuct

import logging
logger = logging.getLogger(__name__)

class MyPlayground:
    def __init__(self):
        self.tutti = TuttiDuct()

    async def catchall_event_handler(self, rid, eid, data):
        print(eid, data)

    async def on_open(self):
        await self.tutti.controllers["resource"].list_projects()

    async def main(self):
        self.tutti.add_onopen_handler(self.on_open)
        self.tutti.event_listeners["resource"].on("list_projects", self.on_list_projects)

        await self.tutti.open("http://localhost/ducts/wsd")

    async def on_list_projects(self, data, is_error):
        if is_error:
            # handle error here

            '''
            data = {
                Status: "Error",
                Reason: str,
                Timestamp: {
                  "Requested": int,
                  "Responded": int
                }
            }
            '''
        else:
            print(data)
            # do anything here

            '''
            data = {
              Contents: {
                 ...
              },
              Timestamp: {
                "Requested": int,
                "Responded": int
              }
            }
            '''


if __name__=="__main__":
    pg = MyPlayground()
    asyncio.run(pg.main())

Handling Events with Event Listeners

tutti.event_listeners["{source}"].on("{method}", handler_func)

Executing Methods with Controllers

tutti.controllers["{source}"].{method}([ ... args])

Sources

  • resource ... Tutti-relevant resources (projects, templates, nanotasks, answers, ...)
  • mturk ... Amazon Mechanical Turk-relevant operations (wrapper methods for Python Boto3 MTurk API)

Methods

Resource

get_event_history

  • Parameters: None
  • Gets all input parameter histories set by setEventHistory.

set_event_history

  • Parameters: eid, query
  • Sets input parameters to a history.

list_projects

  • Parameters: None
  • Lists Tutti projects.

create_project

  • Parameters: ProjectName
  • Creates a Tutti project.

list_templates

  • Parameters: ProjectName
  • Lists Tutti templates for the specified project.

get_responses_for_template

  • Parameters: ProjectName, TemplateName
  • Lists all worker responses for the specified template.

get_responses_for_nanotask

  • Parameters: NanotaskId

create_templates

  • Parameters: ProjectName, TemplateNames, PresetEnvName, PresetTemplateName

list_template_presets

  • Parameters: None

get_project_scheme

  • Parameters: ProjectName, Cached

get_nanotasks

  • Parameters: ProjectName, TemplateName

delete_nanotasks

  • Parameters: ProjectName, TemplateName, NanotaskIds

update_nanotask_num_assignable

  • Parameters: ProjectName, TemplateName, NanotaskId, NumAssignable

upload_nanotasks

  • Parameters: ProjectName, TemplateName, Nanotasks, NumAssignable, Priority, TagName

get_template_node

  • Parameters: Target, WorkSessionId, NodeSessionId

create_session

  • Parameters: ProjectName, PlatformWorkerId, ClientToken, Platform

set_response

  • Parameters: WorkSessionId, NodeSessionId, Answers

check_platform_worker_id_existence_for_project

  • Parameters: ProjectName, Platform, PlatformWorkerId

MTurk

get_credentials

  • Parameters: None

set_credentials

  • Parameters: AccessKeyId, SecretAccessKey

set_sandbox

  • Parameters: Enabled

clear_credentials

  • Parameters: None

delete_qualifications

  • Parameters: QualificationTypeIds

list_qualifications

  • Parameters: None

list_workers_with_qualification_type

  • Parameters: QualificationTypeId

create_qualification

  • Parameters: QualificationTypeParams

associate_qualifications_with_workers

  • Parameters: AssociateQualificationParams

list_workers

  • Parameters: None

notify_workers

  • Parameters: Subject, MessageText, SendEmailWorkerIds

create_hit_type

  • Parameters: CreateHITTypeParams, HITTypeQualificationTypeId

create_hits_with_hit_type

  • Parameters: ProjectName, NumHITs, CreateHITsWithHITTypeParams

get_hit_types

  • Parameters: HITTypeIds

expire_hits

  • Parameters: HITIds

delete_hits

  • Parameters: HITIds

list_hits

  • Parameters: Cached

list_hits_for_hit_type

  • Parameters: HITTypeId=null, Cached=true

list_assignments

  • Parameters: Cached

list_assignments_for_hits

  • Parameters: HITIds

approve_assignments

  • Parameters: AssignmentIds, RequesterFeedback

reject_assignments

  • Parameters: AssignmentIds, RequesterFeedback

get_assignments

  • Parameters: AssignmentIds

Metadata

Release files for tutti-client 0.3.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tutti-client 0.3.8
File Size Uploaded Provenance Actions
tutti-client-0.3.8.tar.gz 18.8 kB Without provenance Details for tutti-client-0.3.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tutti-client 0.3.8
File Interpreter ABI Platform Actions
tutti_client-0.3.8-py2.py3-none-any.whl Python 3, Python 2 none any Details for tutti_client-0.3.8-py2.py3-none-any.whl

Total release size: 34.2 kB

Release files / tutti-client-0.3.8.tar.gz

Download URL tutti-client-0.3.8.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f27e7b6a7d330ca9b30465d3e4eedd584012fef9f23c504fdf398115baee4ca9
BLAKE2b-256 checksum
How to use checksums
8ce7a27b024d62ccc33711718b92d937f54605062d5fb60dca16b4a89101af37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / tutti_client-0.3.8-py2.py3-none-any.whl

Download URL tutti_client-0.3.8-py2.py3-none-any.whl
Size 15.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
afa23d7e32bbae355603341d6e20b5297c51b019561ac7eed6ee73c2018cfe4d
BLAKE2b-256 checksum
How to use checksums
1acb90595af4e97fc5bdf845e3d6dcce420930f68bcb29638b9c454c0fc9eaad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Security for tutti-client 0.3.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page