Boto and comparator "In"

I am trying to use the “B” comparator with boto to specify multiple locales in Mechanical Turk workstations. This answer says that it is possible, as well as AMT docs .

I tried:

min_qualifications.add( LocaleRequirement( comparator='In', required_to_preview=False, locale=['US', 'CA', 'GB', 'IE', 'AU'])) 

I also tried, in different ways:

 locale='US, CA, GB, IE, AU' locale='US|CA|GB|IE|AU' locale='US CA GB IE AU' 

How to do it?

+2
source share
1 answer

Just because something is possible in the mTurk API does not mean that Boto will support it. Boto has not been updated yet.

Here's how to do it with mturk-python :

 import mturk m = mturk.MechanicalTurk() question = """ <QuestionForm xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionForm.xsd"> <Question> <QuestionIdentifier>answer</QuestionIdentifier> <QuestionContent> <Text>Hello world :^)</Text> </QuestionContent> <AnswerSpecification> <FreeTextAnswer/> </AnswerSpecification> </Question> </QuestionForm> """ qual = [ {'QualificationTypeId' : mturk.LOCALE, 'Comparator' : 'In', 'LocaleValue' : [{'Country':'GB'},{'Country':'US'},{'Country':'AU'}]}, ] reward = {'Amount' : 0, 'CurrencyCode' : 'USD'} createhit = {"Title" : "Multiple locales", "Description" : "https://github.com/ctrlcctrlv/mturk-python", "Keywords" : "testing, one, two, three", "Reward" : reward, "Question" : question, "QualificationRequirement" : qual, "AssignmentDurationInSeconds" : 90, "LifetimeInSeconds" : (60*60*24)} r = m.create_request('CreateHIT', createhit) print r print m.flattened_parameters 

enter image description here

+3
source

Source: https://habr.com/ru/post/1412613/


All Articles