Initializing a BucketClient Instance
API Description
Except ObsClient.listBuckets, ObsClient.createPostSignature, and ObsClient.createSignedUrl, BucketClient can implement the same APIs as ObsClient, without requiring the bucketName parameter.
Method Definition
obsClient.bucketClient(
bucketName='*** Your Bucket Name ***'
)
Constructor Parameter Description
|
Field |
Type |
Optional or Mandatory |
Description |
|---|---|---|---|
|
bucket_name |
str |
Mandatory |
Name of the bucket client to be created |
Sample Code
# Import the module.
from obs import ObsClient
# Create an instance of ObsClient.
obsClient = ObsClient(
access_key_id='*** Provide your Access Key ***',
secret_access_key='*** Provide your Secret Key ***',
server='https://your-endpoint'
)
# Create an instance of BucketClient.
bucketClient = obsClient.bucketClient('bucketname')
# Create a Bucket.
resp = bucketClient.createBucket()
if resp.status < 300:
print('requestId:', resp.requestId)
else:
print('errorCode:', resp.errorCode)
print('errorMessage:', resp.errorMessage)
Except ObsClient.listBuckets, ObsClient.createPostSignature, and ObsClient.createSignedUrl, BucketClient can implement the same APIs as ObsClient, without requiring the bucketName parameter.
Last Article: Initializing an Instance of ObsClient
Next Article: Initializing Logs
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.