• Object Storage Service

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

PUT Bucket quota

API Description

You can use this API to set the bucket quota. A bucket quota must be expressed in bytes and the maximum value is 263-1. Value 0 indicates that no upper limit is set for the bucket quota.

Method Definition

ObsClient.setBucketQuota(bucketName, quota)

Request Parameter

Field

Type

Optional or Mandatory

Description

bucketName

str

Mandatory

Bucket name

quota

int

Mandatory

Bucket quota. The value is a non-negative integer.

Returned Result

Type

Description

GetResult

SDK common result object

Sample Code

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