如何在使用boto3在mturk中扩展HIT时修复日期时间错误

时间:2017-04-09 21:09:46

标签: datetime boto3 mechanicalturk

尝试在每API instructions

点击列表中延长到期时间
for hit_id in expired_hit_list:
    response = client.update_expiration_for_hit(
        HITId=hit_id,
        ExpireAt=datetime(2017, 4, 9, 19, 9, 41, tzinfo=tzlocal())
    )

收到错误:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-59-e0764e20a54b> in <module>()
      2     response = client.update_expiration_for_hit(
      3         HITId=hit_id,
----> 4         ExpireAt=datetime(2017, 4, 9, 19, 9, 41, tzinfo=tzlocal())
      5     )

NameError: name 'datetime' is not defined

我也尝试过datetime.datetime和dateTime,也只是删除了它。

ExpireAt=(2017, 4, 9, 19, 9, 41, tzinfo=tzlocal())
没什么工作的。建议?

1 个答案:

答案 0 :(得分:0)

这只是我的Python设置问题,与boto3无关

import datetime
from dateutil.tz import tzlocal