MTurk用格式化文本答案

时间:2015-02-13 21:39:41

标签: python boto mechanicalturk

我有以下当前代码来创建答案选择:

q1_answer_options=[('No URL exists', 0), ('http://www.imdb.com/name/nm2271332/', 1), ('http://www.imdb.com/title/tt0460987/', 2), ('http://www.imdb.com/title/tt1450653/', 3),  ('http://www.imdb.com/title/tt1438289/', 4)]
fta1 = SelectionAnswer(style='radiobutton', selections=q1_answer_options)

例如:

# Currently is this
<Selection>
  <SelectionIdentifier>0</SelectionIdentifier>
  <Text>No URL Exists</Text>
</Selection>

# I want it to be this
<Selection>
  <SelectionIdentifier>0</SelectionIdentifier>
  <FormattedContent><![CDATA[No URL Exists]]></FormattedContent>
</Selection>

如何将answer_options转换为带有boto的格式化文本?

1 个答案:

答案 0 :(得分:0)

以下是如何自定义CreateQualificationType方法的任何部分:

conn = MTurkConnection(self.aws_access_key, self.aws_secret_key, host=self.host)

params = dict()
params['Operation'] = 'CreateQualificationType'
params['QualificationTypeStatus'] = 'Active'
params['Name'] = name
params['TestDurationInSeconds'] = test_duration
params['RetryDelayInSeconds'] = retry_delay
params['Keywords'] = keywords
params['Description'] = description
params['Test'] = test_as_xml
params['AnswerKey'] = answer_key_as_xml


response = m.conn.make_request(action=None, params=params, path='/', verb='POST)
m.conn._process_response(response) # this is the response and will tell if if there are any errors