【发布时间】:2019-08-26 13:10:46
【问题描述】:
当我用这个 python 脚本创建新的 HIT programmatically 时(从这个 tutorial 得到它):
import boto3
import os
MTURK_SANDBOX = 'https://mturk-requester-sandbox.us-east-1.amazonaws.com'
mturk = boto3.client('mturk',
aws_access_key_id=os.environ['AWS_ACCESS_KEY'],
aws_secret_access_key=os.environ['AWS_SECRET_KEY'],
region_name='us-east-1',
endpoint_url=MTURK_SANDBOX
)
with open('template.xml', 'r') as f:
question = f.read()
new_hit = mturk.create_hit(
Title = 'Choose either this page xxx or yyy',
Description = 'Choose the correct category for the document',
Keywords = 'document, classification',
Reward = '0.15',
MaxAssignments = 1,
LifetimeInSeconds = 172800,
AssignmentDurationInSeconds = 600,
AutoApprovalDelayInSeconds = 14400,
Question = question,
)
print('\n'.join(["A new HIT has been created. You can preview it here:",
"https://workersandbox.mturk.com/mturk/preview?groupId={0}".format(new_hit['HIT']['HITGroupId']),
"HITID = {0} (Use to Get Results)".format(new_hit['HIT']['HITId'])]))
template.xml 看起来像:
<HTMLQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2011-11-11/HTMLQuestion.xsd">
<HTMLContent><![CDATA[
<!DOCTYPE html>
<body>
<script src="https://assets.crowd.aws/crowd-html-elements.js"></script>
<crowd-form answer-format="flatten-objects">
<crowd-classifier
categories="['xxx', 'yyy', 'zzz']"
header="Does this page contain xxx or yyy?"
name="category">
<classification-target>
<iframe src="${document_url}" style="width: 100%; height: 600px;"></iframe>
</classification-target>
<short-instructions>Please choose the correct category for the document</short-instructions>
<full-instructions header="Document Classification Instructions">
<p>Some instructions...</p>
</full-instructions>
</crowd-classifier>
</crowd-form>
</body>
</html>
]]></HTMLContent>
<FrameHeight>0</FrameHeight>
</HTMLQuestion>
它成功创建了新的 HIT 并将 HIT_ID 打印到控制台输出,但我无法在 https://requestersandbox.mturk.com/create/projects 的请求者沙箱帐户中的项目下看到它,以便为 document_url 属性上传 CSV 批处理文件。但是我可以通过list_hits API 方法看到它。
我正在使用具有mechanical turk full access 权限的 IAM 帐户,该帐户是我在与 MTurk 帐户相关联的主帐户下创建的。
【问题讨论】:
标签: python mechanicalturk