def test_restore_key_headers(): conn = boto.connect_s3('the_key', 'the_secret') bucket = conn.create_bucket("foobar") key = Key(bucket) key.key = "the-key" key.set_contents_from_string("some value") key.restore(1, headers={'foo': 'bar'}) key = bucket.get_key('the-key') key.ongoing_restore.should_not.be.none key.ongoing_restore.should.be.false key.expiry_date.should.equal("Mon, 02 Jan 2012 12:00:00 GMT")
def restore_archived_file(self, bucket_name, key_name, days=S3_FILE_RESTORE_TIME): """ Restores a file that has been archived to glacier back to s3. Can take up to 4 hours :param days: :param bucket_name: :param key_name: :return: """ bucket = self.get_bucket(bucket_name) key = Key(bucket) key.key = key_name key.restore(days=days)