本文整理匯總了Python中swiftclient.Connection.post_object方法的典型用法代碼示例。如果您正苦於以下問題:Python Connection.post_object方法的具體用法?Python Connection.post_object怎麽用?Python Connection.post_object使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類swiftclient.Connection
的用法示例。
在下文中一共展示了Connection.post_object方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from swiftclient import Connection [as 別名]
# 或者: from swiftclient.Connection import post_object [as 別名]
#.........這裏部分代碼省略.........
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
"""
try:
self.swift_client.delete_object(self.container, self.object)
self.logger.warning("Object Deleted")
except Exception as e:
self.success, self.overall_success = False, False
self.failure = e
self.logger.error(
"Object Delete failed %s", sys.exc_info()[1])
@monitoring.timeit
def delete_container(self):
"""
Delete the container that was created earlier in the process flow
"""
try: