boto.s3.key.Key.last_modified format #466

ohe opened this Issue Jan 10, 2012 · 3 comments


None yet

3 participants

ohe commented Jan 10, 2012

The last_modified property of a s3.key.Key does not always have the same format

For example:

>>> import boto
>>> cx = boto.connect_s3("XXXX", "XXXX")
>>> bucket = cx.get_bucket("mybucket")
>>> rs = bucket.get_all_keys()
>>> rs[0].last_modified
>>> bucket.get_key(rs[0].name).last_modified
'Thu, 29 Dec 2011 12:51:15 GMT'

I do not find any time conversion functions in boto. Does AWS return the "Last-Modified" header differently for different requests?

garnaat commented Jan 16, 2012

Yes, S3 does actually return two different format datestrings.

When listing a bucket (GET on bucket) see for details.

When retrieve an object (GET on object) see for details.

Perhaps boto should be normalizing these.

irskep commented Apr 6, 2012

mrjob ran into this issue recently and has a fix:

(The comment in the code blames boto, but it's really Amazon's fault. I wrote the comment before I read this issue, sorry guys!)

@spulec spulec referenced this issue in spulec/moto Mar 29, 2013

Key.last_modified is None #8

garnaat commented Jul 11, 2013

We feel it is better to return the timestamps as they are returned by the service. Closing.

@garnaat garnaat closed this Jul 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment