• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (Python SDK)
  4. Bucket-Related APIs
  5. List Multipart uploads

List Multipart uploads

API Description

You can use this API to list the multipart uploads that are initialized but not combined or aborted in a specified bucket.

Method Definition

ObsClient.listMultipartUploads(bucketName, multipart)

Request Parameter

Field

Type

Optional or Mandatory

Description

bucket

str

Mandatory

Bucket name

multipart

ListMultipartUploadsRequest

Optional

Request parameter of List Multipart uploads

Returned Result

Type

Description

GetResult

SDK common result object

GetResult.body Type

Description

ListMultipartUploadsResponse

Response result of List Multipart uploads

Sample Code

try:
    from com.obs.models.list_multipart_uploads_request import ListMultipartUploadsRequest 
    multipart = ListMultipartUploadsRequest(prefix='prefix', max_uploads=10) 
     
    resp = obsClient.listMultipartUploads('bucketname', multipart) 
     
    if resp.status < 300: 
        print('requestId:', resp.requestId) 
        print('bucket:', resp.body.bucket) 
        print('prefix:', resp.body.prefix) 
        print('maxUploads:', resp.body.maxUploads) 
        print('isTruncated:', resp.body.isTruncated) 
        index = 1 
        for upload in resp.body.upload: 
            print('upload [' + str(index) + ']') 
            print('key:', upload.key) 
            print('uploadId:', upload.uploadId) 
            print('storageClass:', upload.storageClass) 
            print('initiated:', upload.initiated) 
            print('owner_id:', upload.owner.owner_id) 
            print('owner_name:', upload.owner.owner_name) 
            index += 1 
    else: 
        print('errorCode:', resp.errorCode) 
        print('errorMessage:', resp.errorMessage)
except:
    import traceback
    print(traceback.format_exc())