Python 使用MTurk的externalQuestion创建的命中在沙箱中不起作用
我是MTurk的新手,一直在尝试在这个平台上实现我的点评web应用程序。我已经根据kaflurbaleen.blogspot的教程使用ExternalQuestion成功创建了一个命中。但是,当我在沙箱中测试代码时,我意识到命中没有按预期工作。我发现如下两个问题Python 使用MTurk的externalQuestion创建的命中在沙箱中不起作用,python,amazon,boto3,mechanicalturk,Python,Amazon,Boto3,Mechanicalturk,我是MTurk的新手,一直在尝试在这个平台上实现我的点评web应用程序。我已经根据kaflurbaleen.blogspot的教程使用ExternalQuestion成功创建了一个命中。但是,当我在沙箱中测试代码时,我意识到命中没有按预期工作。我发现如下两个问题 我找不到应该附加到URL的“assignmentId”。在接受任务之前,我检查了workersandbox并找到了以下URL 据我所知,“assignmentId”应该在接受上述链接后附加到URL。必须使用“externalSubmi
import boto.mturk.connection
# define the host environment
sandbox_host = 'mechanicalturk.sandbox.amazonaws.com'
real_host = 'mechanicalturk.amazonaws.com'
mturk = boto.mturk.connection.MTurkConnection(
host = sandbox_host,
debug = 1
)
# test the setup of boto by printing the version and account balance
print(boto.Version)
print(mturk.get_account_balance())
# link to my web app, which will be loaded by the iframe of Mturk
URL = "https://s3.amazonaws.com/www.pickvertex3js.com/vertexpicking.html"
# setting task description of the iframe
title = "A Special HIT for Picking!"
description = "Vertex picking!"
keywords = ["3D mesh", "vertices"]
frame_height = 500 # the height of the iframe holding the external hit
amount = .00
# creating the HIT (task)
questionform = boto.mturk.question.ExternalQuestion( URL, frame_height )
response = mturk.create_hit(
title = title,
description = description,
keywords = keywords,
question = questionform,
reward = boto.mturk.price.Price( amount = amount),
response_groups = ('Minimal', 'HITDetail'),
)
# trying to get some outputs
HIT = response[0]
assert response.status
print ('[create_hit( %s, $%s ): %s]' % ( URL, amount, HIT.HITId ) )
# The response included several fields that will be helpful later
print ('Your HIT has been created. You can see it at this link:')
print ('https://workersandbox.mturk.com/mturk/preview?groupId={}'.format(HIT.HITTypeId))
print ('Your HIT ID is: {}'.format(HIT.HITId))
我也在AWS开发者论坛上发布了回复,但也在这里添加了回复 以下是帖子: 这里有一份副本供其他人使用,以便从中受益: 我看了你的热门歌曲,想在这里提供一些建议。首先,一些基本的东西,以防它们有所帮助: 1) 正在将assignmentId正确添加到您的点击中。您可以通过加载共享的页面(),单击View Source并滚动到标记来确认这一点。您应该看到如下内容:
<iframe height="500" scrolling="auto" frameborder="0" align="center" src="https://s3.amazonaws.com/www.pickvertex3js.com/vertexpicking.html?assignmentId=ASSIGNMENT_ID_NOT_AVAILABLE&hitId=33K3E8REWX0SAJQPACFE1K5LTDBX8G" name="ExternalQuestionIFrame"></iframe>
<iframe height="500" scrolling="auto" frameborder="0" align="center" src="https://s3.amazonaws.com/www.pickvertex3js.com/vertexpicking.html?assignmentId=38YMOXR4MW4S3P05XVRV37Q4QFGW6D&hitId=33K3E8REWX0SAJQPACFE1K5LTDBX8G&workerId=A39ECJ12CY7TE9&turkSubmitTo=https%3A%2F%2Fworkersandbox.mturk.com" name="ExternalQuestionIFrame"></iframe>
var mouse3D = new THREE.Vector3( ( event.clientX / window.innerWidth ) * 2 - 1,
-( event.clientY / window.innerHeight ) * 2 + 1,
0.5 );
没有使用正确的窗口(即,没有使用IFRAME视口,而是使用整个浏览器窗口,导致奇怪/错误/错误的行为)
简短的版本是,我不认为您的问题与MTurk本身有关,而是与IFRAME有关。作为一个不理想的解决方案,您还可以考虑将工作人员直接链接到您的页面(而不是iFrAME),并将其链接到MTURK上的提交URL。这并不理想,但我认为它可以工作
希望有帮助