MCPcopy Create free account
hub / github.com/s3tools/s3cmd / _expiration_set

Method _expiration_set

S3/S3.py:657–680  ·  view source on GitHub ↗
(self, uri)

Source from the content-addressed store, hash-verified

655 return response
656
657 def _expiration_set(self, uri):
658 debug("put bucket lifecycle")
659 body = '<LifecycleConfiguration>'
660 body += ' <Rule>'
661 body += ' <Filter>'
662 body += ' <Prefix>%s</Prefix>' % self.config.expiry_prefix
663 body += ' </Filter>'
664 body += ' <Status>Enabled</Status>'
665 body += ' <Expiration>'
666 if self.config.expiry_date:
667 body += ' <Date>%s</Date>' % self.config.expiry_date
668 elif self.config.expiry_days:
669 body += ' <Days>%s</Days>' % self.config.expiry_days
670 body += ' </Expiration>'
671 body += ' </Rule>'
672 body += '</LifecycleConfiguration>'
673
674 headers = SortedDict(ignore_case = True)
675 headers['content-md5'] = generate_content_md5(body)
676 bucket = uri.bucket()
677 request = self.create_request("BUCKET_CREATE", bucket = bucket,
678 headers = headers, body = body,
679 uri_params = {'lifecycle': None})
680 return (request)
681
682 def _guess_content_type(self, filename):
683 content_type = self.config.default_mime_type

Callers 1

expiration_setMethod · 0.95

Calls 4

create_requestMethod · 0.95
SortedDictClass · 0.90
generate_content_md5Function · 0.85
bucketMethod · 0.80

Tested by

no test coverage detected