本文整理汇总了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)