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

Closed
ohe opened this Issue Jan 10, 2012 · 3 comments

Projects

None yet

3 participants

@ohe
Contributor
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
u'2011-12-29T12:51:15.000Z'
>>> 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
Member
garnaat commented Jan 16, 2012

Yes, S3 does actually return two different format datestrings.

When listing a bucket (GET on bucket) see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketGET.html for details.

When retrieve an object (GET on object) see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectGET.html for details.

Perhaps boto should be normalizing these.

@irskep
Contributor
irskep commented Apr 6, 2012

mrjob ran into this issue recently and has a fix: https://github.com/Yelp/mrjob/blob/master/mrjob/emr.py#L203

(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
Closed

Key.last_modified is None #8

@garnaat
Member
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