Ability to set last-modified of s3 keys
See original GitHub issuewith the current S3 API it’s impossible to set the last-modified time of an S3 key, however this is very useful for testing.
I found a hacky way of doing this via:
key = self._moto_svc._main_app.app_instances['s3'].view_functions['ResponseObject.key_response'].callback.__self__.backend.buckets[BUCKET_NAME].keys[KEY_NAME]
key.last_modified = LAST_MODIFIED
however it would be really useful if there was a better way to access the underlying bucket to be able to set properties like this.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Getting S3 objects' last modified datetimes with boto
Here's a snippet of Python/boto code that will print the last_modified attribute of all keys in a bucket: >>> import boto >>> s3...
Read more >Is there a way to not change an S3 object's Last-Modified date ...
Last Modified is being set automatically by AWS and we can not disable it ... You should be able to see it in...
Read more >ListObjectsV2 - Amazon Simple Storage Service
Encoding type used by Amazon S3 to encode object keys in the response. Valid Values: url ... Sets the maximum number of keys...
Read more >AWS S3 Last Modified date - Adrian Macal - Medium
AWS S3 is not a file system, but exposes “Last Modified” date which is a bit confusing, because S3 object is not modifiable,...
Read more >Amazon S3 FAQs
Amazon S3 is a simple key-based object store. ... client-side library if you want to maintain control of your encryption keys, are able...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FYI, in newer versions you have to use:
@spulec any hope of getting a way to do this in standalone server mode? I’m using
moto
with a Rails app and test suite, and we’re depending on last-modified logic for some tests I’d love to do in moto.