本文整理汇总了Python中swiftclient.Connection.post_container方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.post_container方法的具体用法?Python Connection.post_container怎么用?Python Connection.post_container使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类swiftclient.Connection
的用法示例。
在下文中一共展示了Connection.post_container方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from swiftclient import Connection [as 别名]
# 或者: from swiftclient.Connection import post_container [as 别名]
#.........这里部分代码省略.........
self.success, self.overall_success = False, False
self.failure = e
self.logger.error(
"Getting Container Head failed: %s", sys.exc_info()[1])
@monitoring.timeit
def update_metadata_account(self):
"""
Update the metadata of the account
"""
try:
self.success = True
headers = {"X-Account-Meta-Temp-User": "testuser"}
self.swift_client.post_account(headers)
self.logger.warning(
"Posting Metadata to Account succeeded: %s", headers)
except Exception as e:
self.success, self.overall_success = False, False
self.failure = e
self.logger.error(
"Posting Metadata to Account failed %s", sys.exc_info()[1])
@monitoring.timeit
def update_metadata_container(self):
"""
Update the metadata of the container
"""
try:
self.success = True
headers = {"X-Container-Meta-Temp-User": "testuser"}
self.swift_client.post_container(self.container, headers)
self.logger.warning(
"Posting Metadata to Container succeeded: %s", headers)
except Exception as e:
self.success, self.overall_success = False, False
self.failure = e
self.logger.error(
"Posting Metadata to Container failed %s", sys.exc_info()[1])
@monitoring.timeit
def update_metadata_object(self):
"""
Update the metadata of the object
"""
try:
self.success = True
headers = {"X-Object-Meta-Temp-User": "testuser"}
self.swift_client.post_object(self.container, self.object, headers)
self.logger.warning(
"Posting Metadata to Object succeeded: %s", headers)
except Exception as e:
self.success, self.overall_success = False, False
self.failure = e
self.logger.error(
"Posting Metadata to Object failed %s", sys.exc_info()[1])
@monitoring.timeit
def delete_object(self):
"""
Delete the object created earlier in the process flow