【问题标题】:HIT instance has no attribute 'Title' for HITs returned by boto对于 boto 返回的 HIT,HIT 实例没有属性“标题”
【发布时间】:2016-07-27 23:45:34
【问题描述】:

我正在使用 boto 库来玩弄 Amazon MTurk。我想检索一些可审查的 HIT,并显示它们的属性。例如:

hits = self.mturk_conn.get_reviewable_hits(page_size=30, status='Reviewable', sort_by='Expiration', sort_direction='Ascending', page_number=1)

for h in hits:
    print '%s: %s' % (h.HITId, h.Title)

我确实设法获得了HITId,但由于某种原因我无法获得Title,因为我收到了这个错误消息:

AttributeError: HIT instance has no attribute 'Title'

查看 AWS API (http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkAPI/ApiReference_HITDataStructureArticle.html) 表明该属性应该存在。事实上,如果我通过botoget_hit 方法获得单个HIT,则Title 属性存在。为什么这对于get_reviewable_hits 方法返回的 HIT 不起作用?

【问题讨论】:

    标签: amazon-web-services boto mechanicalturk


    【解决方案1】:

    查看actual operation that you are calling 的示例响应。

    而单数 GetHIT call 返回完整的 HIT 数据结构。

    正如您在 HIT 数据结构的 article 中所见,并非所有属性都是必需的。

    这取决于您进行的 API 调用,HIT 响应对象具有哪些属性。 (令人困惑,对吧!?)

    在这种情况下,您实际上必须调用 GetReviewableHITs,然后使用为 GetHIT 返回的 HITId 来获取包含 Title 属性的完整结构。

    顺便说一句,您可以使用my Python mTurk API,而不是使用 Boto,它使用 API 文档中的确切名称 :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-26
      • 1970-01-01
      相关资源
      最近更新 更多