本文整理匯總了Python中botocore.utils.S3_ACCELERATE_WHITELIST屬性的典型用法代碼示例。如果您正苦於以下問題:Python utils.S3_ACCELERATE_WHITELIST屬性的具體用法?Python utils.S3_ACCELERATE_WHITELIST怎麽用?Python utils.S3_ACCELERATE_WHITELIST使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類botocore.utils
的用法示例。
在下文中一共展示了utils.S3_ACCELERATE_WHITELIST屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _is_s3_accelerate
# 需要導入模塊: from botocore import utils [as 別名]
# 或者: from botocore.utils import S3_ACCELERATE_WHITELIST [as 別名]
def _is_s3_accelerate(self, endpoint_url, s3_config):
# Accelerate has been explicitly configured.
if s3_config is not None and s3_config.get('use_accelerate_endpoint'):
return True
# Accelerate mode is turned on automatically if an endpoint url is
# provided that matches the accelerate scheme.
if endpoint_url is None:
return False
# Accelerate is only valid for Amazon endpoints.
netloc = urlsplit(endpoint_url).netloc
if not netloc.endswith('amazonaws.com'):
return False
# The first part of the url should always be s3-accelerate.
parts = netloc.split('.')
if parts[0] != 's3-accelerate':
return False
# Url parts between 's3-accelerate' and 'amazonaws.com' which
# represent different url features.
feature_parts = parts[1:-2]
# There should be no duplicate url parts.
if len(feature_parts) != len(set(feature_parts)):
return False
# Remaining parts must all be in the whitelist.
return all(p in S3_ACCELERATE_WHITELIST for p in feature_parts)