你如何用boto3更新MTurk工人资格分数?

时间:2017-06-15 20:48:58

标签: aws-sdk boto3 mechanicalturk

较旧的MTurk API(和boto2)有一个UpdateQualificationScore方法,允许用户更新特定工作人员的分数,但这似乎已在最新版本中消失在boto3

最新的MTurk API具有GetQualificationScore方法(实际上返回完整的工作人员资格记录,而不仅仅是分数),但没有相应的UpdateQualificationScore方法。更新现有员工的分数的机制是什么?

2 个答案:

答案 0 :(得分:1)

据我所知,使用boto3执行此操作的正确方法是使用AssociateQualificationWithWorker端点:

session = boto3.Session(profile_name='mturk')
client = session.client('mturk')
response = client.associate_qualification_with_worker(
    QualificationTypeId=qualification_type_id,
    WorkerId=worker_id,
    IntegerValue=score,
    SendNotification=False,
)

似乎可行,尤其是与GetQualificationScore一起返回“完整”资格记录而不仅仅是分数时。

答案 1 :(得分:0)

前书呆子的回答是正确的。基于http://requester.mturk.com/developer提供的Python示例,以下工作分配QualificationType然后更改该Worker的分数:

import boto3

region_name = 'us-east-1'
aws_access_key_id = 'YOUR_ACCESS_ID'
aws_secret_access_key = 'YOUR_SECRET_KEY'

endpoint_url = 'https://mturk-requester-sandbox.us-east-1.amazonaws.com'

# Uncomment this line to use in production
# endpoint_url = 'https://mturk-requester.us-east-1.amazonaws.com'

client = boto3.client(
    'mturk',
    endpoint_url=endpoint_url,
    region_name=region_name,
    aws_access_key_id=aws_access_key_id,
    aws_secret_access_key=aws_secret_access_key,
)

# This will assign the QualificationType
client.associate_qualification_with_worker(QualificationTypeId = '3KIOU9ULHKIIS5OPUVORW7OE1070V0', WorkerId = 'A39ECJ12CY7TE9', IntegerValue = 100)

# This will set the QualificationScore from 100 to 90
client.associate_qualification_with_worker(QualificationTypeId = '3KIOU9ULHKIIS5OPUVORW7OE1070V0', WorkerId = 'A39ECJ12CY7TE9', IntegerValue = 90)