小编fri*_*son的帖子

使用boto和python通过参数从Layout创建mTurk HIT

我试图利用boto在机械土耳其人中生成HIT.目标是使用已在我的mTurk帐户上生成的公共布局,并将其图像URL传递给迭代创建HIT.

问题是,即使正确命名参数,如果图像url boto不成功.我创建命中的示例代码是:

from boto.mturk.connection import MTurkConnection
from boto.s3.connection import S3Connection
from boto.mturk.layoutparam import LayoutParameter
from boto.s3.key import Key
import datetime

mtc = MTurkConnection(aws_access_key_id=AWSKEY,
                  aws_secret_access_key=AWSSKEY,
                  host=HOST)

#Define the layout ID to use and url to the image being used (bucket and serial defined in another place
LAYOUTID = '30W9SLHWRYCURO27D44916CUTGKDS2'
S3URL = LayoutParameter('image_url','https://s3.amazonaws.com/'+BUCKET_NAME+'/'+SERIAL)
REWARD = 0.05

#Call create_hit to generate the HIT
hit_result = mtc.create_hit(hit_layout=LAYOUTID,layout_params=S3URL,  keywords=keywords_list, reward=REWARD,
                            duration=datetime.timedelta(7),max_assignments=1)
Run Code Online (Sandbox Code Playgroud)

这会生成错误 您的请求缺少必需参数.必需参数包括HITLayoutParameter.您尚未提供所有必需的HITLayout参数.缺少参数名称:image_url

并且为了确保,我的布局ID具有正确的参数名称,当我检查mTurk时我看到(无法发布screengrab):

布局ID:30W9SLHWRYCURO27D44916CUTGKDS2参数:image_url

使用LayoutParameter有什么技巧吗?或者我是以错误的方式使用create_hit?

python mechanicalturk boto python-2.7

5
推荐指数
1
解决办法
778
查看次数

标签 统计

boto ×1

mechanicalturk ×1

python ×1

python-2.7 ×1