亚马逊机械土耳其人 - Rturk - RestClient :: BadRequest:400 Bad Request

时间:2013-01-28 19:23:45

标签: ruby-on-rails ruby-on-rails-3 amazon-web-services mechanicalturk

我正在尝试设立Rturk将一些工作外包给亚马逊的Mechanical Turk。当我尝试创建HITs时,我一直在控制台中遇到错误:

RestClient::BadRequest: 400 Bad Request

当我复制URL并将其粘贴到浏览器中以获得响应时,我收到以下消息:

This user is not authorized to perform the requested operation

你们知道这里会发生什么吗?我正在关注github上的rturk文档。 https://github.com/mdp/rturk宝石是否有可能需要更新?

RTurk.setup(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY_ID'], :sandbox => true)

  hit = RTurk::Hit.create(
    :title => "Sample turk",
    :assignments_duration => 1.hour,
    :expires_at => 1.day.from_now
  ) do |hit|
    hit.lifetime = 1.day
    hit.assignments = 1
    hit.description = "Test description."
    hit.keywords = "places, search, map, location"
    hit.question(mturk-fb_path, :frame_height => 750)
    hit.reward = reward
    if approval_rate
      hit.qualifications.add :approval_rate, { :gt => approval_rate }
    end         if abandoned_rate
      hit.qualifications.add :abandoned_rate, { :lt => abandoned_rate }
    end
    if is_us
      hit.qualifications.add :country, { :eql => "US" }
    end
  end    
}

1 个答案:

答案 0 :(得分:0)

这里可能会发生一些事情:

  • 我不相信:assignments_duration:expires_at是有效选项。您应该使用hit.duration来指定工作人员接受命中后完成命中的时间,并hit.lifetime设置命中过期之前的时间。
  • 这可能只是您帖子中的拼写错误,但mturk-fb_path不是有效的ruby变量名称。 (不能用破折号)

尝试使用最简单的示例开始,一旦你开始工作就可以构建它。来自rturk的这个例子应该是一个好的开始:https://github.com/mdp/rturk#creating-hits

此外,我绝对建议您阅读mturk文档以创建匹配:http://docs.aws.amazon.com/AWSMechTurk/2011-10-01/AWSMturkAPI/ApiReference_CreateHITOperation.html