较旧的MTurk API(和boto2
)有一个UpdateQualificationScore
方法,允许用户更新特定工作人员的分数,但这似乎已在最新版本中消失在boto3
。
最新的MTurk API具有GetQualificationScore
方法(实际上返回完整的工作人员资格记录,而不仅仅是分数),但没有相应的UpdateQualificationScore
方法。更新现有员工的分数的机制是什么?
答案 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)
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)