Obtaining a Bucket Location

API Description

You can use this API to obtain the bucket location.

Method Definition

ObsClient.getBucketLocation(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

LocationResponse

Response result of the request for obtaining a bucket location

Sample Code

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