本文整理汇总了Python中boto.s3.bucket.Bucket.list_multipart_uploads方法的典型用法代码示例。如果您正苦于以下问题:Python Bucket.list_multipart_uploads方法的具体用法?Python Bucket.list_multipart_uploads怎么用?Python Bucket.list_multipart_uploads使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boto.s3.bucket.Bucket
的用法示例。
在下文中一共展示了Bucket.list_multipart_uploads方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rmup
# 需要导入模块: from boto.s3.bucket import Bucket [as 别名]
# 或者: from boto.s3.bucket.Bucket import list_multipart_uploads [as 别名]
def rmup(args):
parser = option_parser("rmup URL [UPLOAD]")
parser.add_option("-a", "--all", dest="all", action="store_true",
default=False, help="Cancel all uploads for the specified bucket")
options, args = parser.parse_args(args)
if options.all:
if len(args) < 1:
parser.error("Specify bucket URL")
else:
if len(args) != 2:
parser.error("Specify bucket URL and UPLOAD")
upload = args[1]
uri = parse_uri(args[0])
if uri.bucket is None:
raise Exception("URL must contain a bucket: %s" % args[0])
if uri.key is not None:
raise Exception("URL cannot contain a key: %s" % args[0])
config = get_config(options)
conn = get_connection(config, uri)
# There is no easy way to do this with boto
b = Bucket(connection=conn, name=uri.bucket)
for up in b.list_multipart_uploads():
if options.all or up.id == upload:
info("Removing upload %s" % up.id)
up.cancel_upload()