tutti-client


Nametutti-client JSON
Version 0.3.8 PyPI version JSON
download
home_pagehttps://github.com/iflb/tutti-client-python
SummaryPython client library for Tutti.ai
upload_time2023-04-17 06:23:07
maintainer
docs_urlNone
authorIntelligent Framework Lab
requires_python>=3.6
license
keywords crowdsourcing annotation framework asyncio
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python client SDK for Tutti.ai

## Installation

```
pip install tutti-client
```

## Importing Module

```python
from tutti_client import TuttiDuct
duct = TuttiDuct()
```

## Usage

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

```python
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](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/mturk.html))

## 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`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/iflb/tutti-client-python",
    "name": "tutti-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "crowdsourcing annotation framework asyncio",
    "author": "Intelligent Framework Lab",
    "author_email": "saito@iflab.tokyo",
    "download_url": "https://files.pythonhosted.org/packages/8c/e7/a27b024d62ccc33711718b92d937f54605062d5fb60dca16b4a89101af37/tutti-client-0.3.8.tar.gz",
    "platform": null,
    "description": "# Python client SDK for Tutti.ai\n\n## Installation\n\n```\npip install tutti-client\n```\n\n## Importing Module\n\n```python\nfrom tutti_client import TuttiDuct\nduct = TuttiDuct()\n```\n\n## Usage\n\nFor example, to obtain a list of your Tutti projects:\n\n```python\nimport asyncio\nfrom tutti_client import TuttiDuct\n\nimport logging\nlogger = logging.getLogger(__name__)\n\nclass MyPlayground:\n    def __init__(self):\n        self.tutti = TuttiDuct()\n\n    async def catchall_event_handler(self, rid, eid, data):\n        print(eid, data)\n\n    async def on_open(self):\n        await self.tutti.controllers[\"resource\"].list_projects()\n\n    async def main(self):\n        self.tutti.add_onopen_handler(self.on_open)\n        self.tutti.event_listeners[\"resource\"].on(\"list_projects\", self.on_list_projects)\n\n        await self.tutti.open(\"http://localhost/ducts/wsd\")\n\n    async def on_list_projects(self, data, is_error):\n        if is_error:\n            # handle error here\n\n            '''\n            data = {\n                Status: \"Error\",\n                Reason: str,\n                Timestamp: {\n                  \"Requested\": int,\n                  \"Responded\": int\n                }\n            }\n            '''\n        else:\n            print(data)\n            # do anything here\n\n            '''\n            data = {\n              Contents: {\n                 ...\n              },\n              Timestamp: {\n                \"Requested\": int,\n                \"Responded\": int\n              }\n            }\n            '''\n\n\nif __name__==\"__main__\":\n    pg = MyPlayground()\n    asyncio.run(pg.main())\n```\n\n## Handling Events with Event Listeners\n\n`tutti.event_listeners[\"{source}\"].on(\"{method}\", handler_func)`\n\n## Executing Methods with Controllers\n\n`tutti.controllers[\"{source}\"].{method}([ ... args])`\n\n## Sources\n\n- `resource` ... Tutti-relevant resources (projects, templates, nanotasks, answers, ...)\n- `mturk` ... Amazon Mechanical Turk-relevant operations (wrapper methods for [Python Boto3 MTurk API](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/mturk.html))\n\n## Methods\n\n### Resource\n\n#### get_event_history\n- Parameters: None\n- Gets all input parameter histories set by setEventHistory.\n\n#### set_event_history\n- Parameters: `eid`, `query`\n- Sets input parameters to a history.\n\n#### list_projects\n- Parameters: None\n- Lists Tutti projects.\n\n#### create_project\n- Parameters: `ProjectName`\n- Creates a Tutti project.\n\n#### list_templates\n- Parameters: `ProjectName`\n- Lists Tutti templates for the specified project.\n\n#### get_responses_for_template\n- Parameters: `ProjectName`, `TemplateName`\n- Lists all worker responses for the specified template.\n\n#### get_responses_for_nanotask\n- Parameters: `NanotaskId`\n\n#### create_templates\n- Parameters: `ProjectName`, `TemplateNames`, `PresetEnvName`, `PresetTemplateName`\n\n#### list_template_presets\n- Parameters: None\n\n#### get_project_scheme\n- Parameters: `ProjectName`, `Cached`\n\n#### get_nanotasks\n- Parameters: `ProjectName`, `TemplateName`\n\n#### delete_nanotasks\n- Parameters: `ProjectName`, `TemplateName`, `NanotaskIds`\n\n#### update_nanotask_num_assignable\n- Parameters: `ProjectName`, `TemplateName`, `NanotaskId`, `NumAssignable`\n\n#### upload_nanotasks\n- Parameters: `ProjectName`, `TemplateName`, `Nanotasks`, `NumAssignable`, `Priority`, `TagName`\n\n#### get_template_node\n- Parameters: `Target`, `WorkSessionId`, `NodeSessionId`\n\n#### create_session\n- Parameters: `ProjectName`, `PlatformWorkerId`, `ClientToken`, `Platform`\n\n#### set_response\n- Parameters: `WorkSessionId`, `NodeSessionId`, `Answers`\n\n#### check_platform_worker_id_existence_for_project\n- Parameters: `ProjectName`, `Platform`, `PlatformWorkerId`\n\n\n  \n### MTurk\n\n#### get_credentials\n- Parameters: None\n\n#### set_credentials\n- Parameters: `AccessKeyId`, `SecretAccessKey`\n\n#### set_sandbox\n- Parameters: `Enabled`\n\n#### clear_credentials\n- Parameters: None\n\n#### delete_qualifications\n- Parameters: `QualificationTypeIds`\n\n#### list_qualifications\n- Parameters: None\n\n#### list_workers_with_qualification_type\n- Parameters: `QualificationTypeId`\n\n#### create_qualification\n- Parameters: `QualificationTypeParams`\n\n#### associate_qualifications_with_workers\n- Parameters: `AssociateQualificationParams`\n\n#### list_workers\n- Parameters: None\n\n#### notify_workers\n- Parameters: `Subject`, `MessageText`, `SendEmailWorkerIds`\n\n#### create_hit_type\n- Parameters: `CreateHITTypeParams`, `HITTypeQualificationTypeId`\n\n#### create_hits_with_hit_type\n- Parameters: `ProjectName`, `NumHITs`, `CreateHITsWithHITTypeParams`\n\n#### get_hit_types\n- Parameters: `HITTypeIds`\n\n#### expire_hits\n- Parameters: `HITIds`\n\n#### delete_hits\n- Parameters: `HITIds`\n\n#### list_hits\n- Parameters: `Cached`\n\n#### list_hits_for_hit_type\n- Parameters: `HITTypeId=null`, `Cached=true`\n\n#### list_assignments\n- Parameters: `Cached`\n\n#### list_assignments_for_hits\n- Parameters: `HITIds`\n\n#### approve_assignments\n- Parameters: `AssignmentIds`, `RequesterFeedback`\n\n#### reject_assignments\n- Parameters: `AssignmentIds`, `RequesterFeedback`\n\n#### get_assignments\n- Parameters: `AssignmentIds`\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python client library for Tutti.ai",
    "version": "0.3.8",
    "split_keywords": [
        "crowdsourcing",
        "annotation",
        "framework",
        "asyncio"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1acb90595af4e97fc5bdf845e3d6dcce420930f68bcb29638b9c454c0fc9eaad",
                "md5": "f55a1f95c4a97bc60e0d356eacaecd72",
                "sha256": "afa23d7e32bbae355603341d6e20b5297c51b019561ac7eed6ee73c2018cfe4d"
            },
            "downloads": -1,
            "filename": "tutti_client-0.3.8-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f55a1f95c4a97bc60e0d356eacaecd72",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 15364,
            "upload_time": "2023-04-17T06:23:04",
            "upload_time_iso_8601": "2023-04-17T06:23:04.942481Z",
            "url": "https://files.pythonhosted.org/packages/1a/cb/90595af4e97fc5bdf845e3d6dcce420930f68bcb29638b9c454c0fc9eaad/tutti_client-0.3.8-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8ce7a27b024d62ccc33711718b92d937f54605062d5fb60dca16b4a89101af37",
                "md5": "d87e2b37a0d83436792054aebf0efba9",
                "sha256": "f27e7b6a7d330ca9b30465d3e4eedd584012fef9f23c504fdf398115baee4ca9"
            },
            "downloads": -1,
            "filename": "tutti-client-0.3.8.tar.gz",
            "has_sig": false,
            "md5_digest": "d87e2b37a0d83436792054aebf0efba9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 18788,
            "upload_time": "2023-04-17T06:23:07",
            "upload_time_iso_8601": "2023-04-17T06:23:07.536452Z",
            "url": "https://files.pythonhosted.org/packages/8c/e7/a27b024d62ccc33711718b92d937f54605062d5fb60dca16b4a89101af37/tutti-client-0.3.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-17 06:23:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "iflb",
    "github_project": "tutti-client-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "tutti-client"
}
        
Elapsed time: 0.07649s