本文整理汇总了Python中azure.storage.BlobService.set_blob_service_properties方法的典型用法代码示例。如果您正苦于以下问题:Python BlobService.set_blob_service_properties方法的具体用法?Python BlobService.set_blob_service_properties怎么用?Python BlobService.set_blob_service_properties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azure.storage.BlobService
的用法示例。
在下文中一共展示了BlobService.set_blob_service_properties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_storage_service_cors_properties
# 需要导入模块: from azure.storage import BlobService [as 别名]
# 或者: from azure.storage.BlobService import set_blob_service_properties [as 别名]
def set_storage_service_cors_properties(account_name, account_key, cors_rules):
"""
Assigns the specified CORS rules to the specified Blob service.
blob_service: Target BlobService object.
cors_rules: A Cors instance specifying the rules to apply.
"""
blob_svc_props = StorageServiceProperties()
blob_svc_props.metrics = None
blob_svc_props.logging = None
setattr(blob_svc_props, 'cors', cors_rules)
def request_filter(request, next_filter):
""" Intercepts request to modify headers."""
request.headers = [(k, v) for (k, v) in request.headers if k not in ('x-ms-version', 'Authorization')]
request.headers.append(('x-ms-version', '2013-08-15'))
request.headers.append(('Authorization', _sign_storage_blob_request(request, account_name, account_key)))
response = next_filter(request)
return response
blob_service = BlobService(account_name, account_key).with_filter(request_filter)
blob_service.set_blob_service_properties(blob_svc_props)