Obtaining Bucket Storage Information
API Description
You can use this API to obtain storage information about a bucket, including the bucket size and number of objects in the bucket.
Method Definition
ObsClient.getBucketStorageInfo(bucketName)
Request Parameters
|
Field |
Type |
Optional or Mandatory |
Description |
|---|---|---|---|
|
bucketName |
str |
Mandatory |
Bucket name |
Returned Results
|
Type |
Description |
|---|---|
|
SDK common result object |
|
GetResult.body Type |
Description |
|---|---|
|
Response result of the request for obtaining storage information about a bucket |
Sample Code
try:
resp = obsClient.getBucketStorageInfo('bucketname')
if resp.status < 300:
print('requestId:', resp.requestId)
print('size:', resp.body.size)
print('objectNumber:', resp.body.objectNumber)
else:
print('errorCode:', resp.errorCode)
print('errorMessage:', resp.errorMessage)
except:
import traceback
print(traceback.format_exc())
Last Article: Obtaining a Bucket Location
Next Article: Setting the Storage Capacity Quota for a Bucket
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.