使用 boto3 在 mturk 中扩展 HIT 时如何修复日期时间错误
How to fix datetime error when extending HIT in mturk using boto3
正在尝试延长每个 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())
没有任何效果。建议?
这只是我的 Python 设置的问题,与 boto3
无关
import datetime
from dateutil.tz import tzlocal
正在尝试延长每个 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())
没有任何效果。建议?
这只是我的 Python 设置的问题,与 boto3
无关import datetime
from dateutil.tz import tzlocal