Help Center> Object Storage Service> SDK Reference> Python> Bucket-Related APIs> Obtaining the Storage Capacity Quota of a Bucket

Obtaining the Storage Capacity Quota of a Bucket

API Description

You can use this API to obtain the storage capacity quota of a bucket. Value 0 indicates that no upper limit is set for the bucket storage capacity.

Method Definition

ObsClient.getBucketQuota(bucketName)

Request Parameters

Field

Type

Optional or Mandatory

Description

bucketName

str

Mandatory

Bucket name

Returned Results

Type

Description

GetResult

SDK common result object

GetResult.body Type

Description

GetBucketQuotaResponse

Response result of the request for obtaining the storage capacity quota of a bucket

Sample Code

try:
    resp = obsClient.getBucketQuota('bucketname') 
     
    if resp.status < 300: 
        print('requestId:', resp.requestId) 
        print('quota:', resp.body.quota) 
    else: 
        print('errorCode:', resp.errorCode) 
        print('errorMessage:', resp.errorMessage)
except:
    import traceback
    print(traceback.format_exc())