API Overview of OBS SDK for Python

Table 1 describes the APIs provided by OBS SDK for Python. You can click an API name in the table to see its detailed information and sample code.

SDK API Overview

Table 1 APIs provided by OBS SDK for Python

Interface

Method

Function

Creating a Bucket

ObsClient.createBucket

Creates a bucket.

Obtaining a Bucket List

ObsClient.listBuckets

Returns a list of buckets in alphabetical order.

Checking Whether a Bucket Exists

ObsClient.headBucket

Determines whether a bucket exists.

Deleting a Bucket

ObsClient.deleteBucket

Deletes an empty bucket.

Listing Objects in a Bucket

ObsClient.listObjects

Returns some or all (up to 1,000) of the objects in a bucket.

Listing Object Versions in a Bucket

ObsClient.listVersions

Lists some or all (up to 1,000) of the object versions in a bucket.

Listing Multipart Uploads

ObsClient.listMultipartUploads

Lists ongoing multipart uploads.

Obtaining Bucket Metadata

ObsClient.getBucketMetadata

Sends a HEAD request to a bucket to obtain the bucket metadata such as CORS rules (if set), the storage class, and other information.

Obtaining the Region of a Bucket

ObsClient.getBucketLocation

Returns the region where the bucket is created.

Obtaining Storage Information of a Bucket

ObsClient.getBucketStorageInfo

Returns the storage information of a bucket, including the number of objects and the space occupied by the objects in the bucket.

Configuring a Storage Quota

ObsClient.setBucketQuota

Sets a storage quota for a bucket.

Obtaining a Bucket Storage Quota

ObsClient.getBucketQuota

Returns the storage quota of a bucket.

Configuring a Storage Class for a Bucket

ObsClient.setBucketStoragePolicy

Configures a storage class for a bucket.

Obtaining the Storage Class of a Bucket

ObsClient.getBucketStoragePolicy

Returns the storage class of a bucket.

Configuring a Bucket ACL

ObsClient.setBucketAcl

Configures a bucket ACL.

Obtaining a Bucket ACL

ObsClient.getBucketAcl

Obtains a bucket ACL.

Configuring Logging for a Bucket

ObsClient.setBucketLogging

Configures logging for a bucket.

Obtaining the Logging Configuration of a Bucket

ObsClient.getBucketLogging

Returns the logging configuration of a bucket.

Configuring a Bucket Policy

ObsClient.setBucketPolicy

Configures a bucket policy. If the bucket already has a policy, the policy will be overwritten by the one specified in this request.

Obtaining the Policy of a Bucket

ObsClient.getBucketPolicy

Returns the policy of a bucket.

Deleting a Bucket Policy

ObsClient.deleteBucketPolicy

Deletes the policy of a bucket.

Configuring Lifecycle Rules for a Bucket

ObsClient.setBucketLifecycle

Configures lifecycle rules for a bucket to periodically transition objects between storage classes or delete objects.

Obtaining the Lifecycle Configuration of a Bucket

ObsClient.getBucketLifecycle

Returns the lifecycle configuration of a bucket.

Deleting the Lifecycle Configuration of a Bucket

ObsClient.deleteBucketLifecycle

Deletes all lifecycle rules of a bucket.

Configuring Static Website Hosting for a Bucket

ObsClient.setBucketWebsite

Configures static website hosting for a bucket.

Obtaining Static Website Hosting for a Bucket

ObsClient.getBucketWebsite

Returns the static website hosting configuration of a bucket.

Deleting Static Website Hosting for a Bucket

ObsClient.deleteBucketWebsite

Deletes the static website hosting configurations of a bucket.

Configuring Versioning for a Bucket

ObsClient.setBucketVersioning

Configures versioning for a bucket.

Obtaining the Versioning Status of a Bucket

ObsClient.getBucketVersioning

Returns the versioning status of a bucket.

Configuring CORS for a Bucket

ObsClient.setBucketCors

Configures CORS for a bucket to allow cross-origin requests.

Obtaining the CORS Configuration of a Bucket

ObsClient.getBucketCors

Returns the CORS rules of a bucket.

Deleting the CORS Configuration of a Bucket

ObsClient.deleteBucketCors

Deletes the CORS configuration of a bucket.

Configuring Tags for a Bucket

ObsClient.setBucketTagging

Configures tags for a bucket.

Obtaining Bucket Tags

ObsClient.getBucketTagging

Returns the tags of a bucket.

Deleting Bucket Tags

ObsClient.deleteBucketTagging

Deletes the tags of a bucket.

Object Upload Overview

ObsClient.putContent

Uploads an object to a bucket.

Uploading an Object - File-Based

ObsClient.putFile

Uploads a file or folder to a bucket.

Uploading an Object - Append

ObsClient.appendObject

Appends content to an uploaded object.

Object Download Overview

ObsClient.getObject

Downloads an object from a bucket.

Copying an Object

ObsClient.copyObject

Creates a copy for a specified object.

Deleting an Object

ObsClient.deleteObject

Deletes a single object from a bucket.

Batch Deleting Objects

ObsClient.deleteObjects

Deletes multiple objects from a bucket in a batch.

Obtaining Object Metadata

ObsClient.getObjectMetadata

Returns the object metadata.

Modifying Object Metadata

ObsClient.setObjectMetadata

Modifies the metadata for an object.

Configuring an Object ACL

ObsClient.setObjectAcl

Configures an ACL for an object in a specified bucket.

Obtaining an Object ACL

ObsClient.getObjectAcl

Obtains the ACL of an object in a specified bucket.

Initiating a Multipart Upload

ObsClient.initiateMultipartUpload

Initiates a multipart upload in a bucket.

Uploading a Part

ObsClient.uploadPart

Uploads parts to a bucket by specifying the multipart upload ID.

Copying a Part

ObsClient.copyPart

Copies a part to a specified bucket by specifying the multipart upload ID.

Listing Uploaded Parts

ObsClient.listParts

Returns the uploaded parts in a bucket by specifying the multipart upload ID.

Assembling Parts

ObsClient.completeMultipartUpload

Completes a multipart upload based on the multipart upload ID.

Aborting a Multipart Upload

ObsClient.abortMultipartUpload

Aborts a multipart upload in a bucket by specifying the multipart upload ID.

Restoring a Cold Object

ObsClient.restoreObject

Restores a Cold object.

Creating a Signed URL

ObsClient.createSignedUrl

Creates a signed URL based on the specified AK and SK, HTTP method, and request parameters.

Generating Authentication Parameters for Browser-Based Uploads

ObsClient.createPostSignature

Creates request parameters for authentication to enable browser-based upload with POST.

Uploading an Object - Resumable

ObsClient.uploadFile

Enables resumable uploads of objects in the event of unstable network connections or program crashes.

Downloading an Object - Resumable

ObsClient.downloadFile

Adds the resumable function to the partial download API.