Package: tutti-client
Python client SDK for Tutti.aiInstallationpip install tutti-clientImporting Modulefromtutti_clientimportTuttiDuctduct=TuttiDuct()UsageFor example, to obtain a list of your Tutti projects:importasynciofromtutti_clientimportTuttiDuctimportlogginglogger=logging.getLogger(__name__)classMyPlayground:def__init__(self):self.tutti=TuttiDuct()asyncdefcatchall_event_handler(self,rid,eid,data):print(eid,data)asyncdefon_open(self):awaitself.tutti.controllers["resource"].list_projects()asyncdefmain(self):self.tutti.add_onopen_handler(self.on_open)self.tutti.event_listeners["resource"].on("list_projects",self.on_list_projects)awaitself.tutti.open("http://localhost/ducts/wsd")asyncdefon_list_projects(self,data,is_error):ifis_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 Listenerstutti.event_listeners["{source}"].on("{method}", handler_func)Executing Methods with Controllerstutti.controllers["{source}"].{method}([ ... args])Sourcesresource... Tutti-relevant resources (projects, templates, nanotasks, answers, ...)mturk... Amazon Mechanical Turk-relevant operations (wrapper methods forPython Boto3 MTurk API)MethodsResourceget_event_historyParameters: NoneGets all input parameter histories set by setEventHistory.set_event_historyParameters:eid,querySets input parameters to a history.list_projectsParameters: NoneLists Tutti projects.create_projectParameters:ProjectNameCreates a Tutti project.list_templatesParameters:ProjectNameLists Tutti templates for the specified project.get_responses_for_templateParameters:ProjectName,TemplateNameLists all worker responses for the specified template.get_responses_for_nanotaskParameters:NanotaskIdcreate_templatesParameters:ProjectName,TemplateNames,PresetEnvName,PresetTemplateNamelist_template_presetsParameters: Noneget_project_schemeParameters:ProjectName,Cachedget_nanotasksParameters:ProjectName,TemplateNamedelete_nanotasksParameters:ProjectName,TemplateName,NanotaskIdsupdate_nanotask_num_assignableParameters:ProjectName,TemplateName,NanotaskId,NumAssignableupload_nanotasksParameters:ProjectName,TemplateName,Nanotasks,NumAssignable,Priority,TagNameget_template_nodeParameters:Target,WorkSessionId,NodeSessionIdcreate_sessionParameters:ProjectName,PlatformWorkerId,ClientToken,Platformset_responseParameters:WorkSessionId,NodeSessionId,Answerscheck_platform_worker_id_existence_for_projectParameters:ProjectName,Platform,PlatformWorkerIdMTurkget_credentialsParameters: Noneset_credentialsParameters:AccessKeyId,SecretAccessKeyset_sandboxParameters:Enabledclear_credentialsParameters: Nonedelete_qualificationsParameters:QualificationTypeIdslist_qualificationsParameters: Nonelist_workers_with_qualification_typeParameters:QualificationTypeIdcreate_qualificationParameters:QualificationTypeParamsassociate_qualifications_with_workersParameters:AssociateQualificationParamslist_workersParameters: Nonenotify_workersParameters:Subject,MessageText,SendEmailWorkerIdscreate_hit_typeParameters:CreateHITTypeParams,HITTypeQualificationTypeIdcreate_hits_with_hit_typeParameters:ProjectName,NumHITs,CreateHITsWithHITTypeParamsget_hit_typesParameters:HITTypeIdsexpire_hitsParameters:HITIdsdelete_hitsParameters:HITIdslist_hitsParameters:Cachedlist_hits_for_hit_typeParameters:HITTypeId=null,Cached=truelist_assignmentsParameters:Cachedlist_assignments_for_hitsParameters:HITIdsapprove_assignmentsParameters:AssignmentIds,RequesterFeedbackreject_assignmentsParameters:AssignmentIds,RequesterFeedbackget_assignmentsParameters:AssignmentIds