Help Center> Object Storage Service> Python> API Overview of OBS SDK for Python
Updated on 2024-06-19 GMT+08:00

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 (SDK for Python)

ObsClient.createBucket

Creates a bucket.

Obtaining a Bucket List (SDK for Python)

ObsClient.listBuckets

Returns a list of buckets in alphabetical order.

Checking Whether a Bucket Exists (SDK for Python)

ObsClient.headBucket

Determines whether a bucket exists.

Deleting a Bucket (SDK for Python)

ObsClient.deleteBucket

Deletes an empty bucket.

Listing Objects in a Bucket (SDK for Python)

ObsClient.listObjects

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

Listing Object Versions in a Bucket (SDK for Python)

ObsClient.listVersions

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

Listing Multipart Uploads (SDK for Python)

ObsClient.listMultipartUploads

Lists ongoing multipart uploads.

Obtaining Bucket Metadata (SDK for Python)

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 (SDK for Python)

ObsClient.getBucketLocation

Returns the region where the bucket is created.

Obtaining Storage Information of a Bucket (SDK for Python)

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 (SDK for Python)

ObsClient.setBucketQuota

Sets a storage quota for a bucket.

Obtaining a Bucket Storage Quota (SDK for Python)

ObsClient.getBucketQuota

Returns the storage quota of a bucket.

Configuring a Storage Class for a Bucket (SDK for Python)

ObsClient.setBucketStoragePolicy

Configures a storage class for a bucket.

Obtaining the Storage Class of a Bucket (SDK for Python)

ObsClient.getBucketStoragePolicy

Returns the storage class of a bucket.

Configuring a Bucket ACL (SDK for Python)

ObsClient.setBucketAcl

Configures the ACL for a bucket.

Obtaining a Bucket ACL (SDK for Python)

ObsClient.getBucketAcl

Returns the bucket ACL.

Configuring Logging for a Bucket (SDK for Python)

ObsClient.setBucketLogging

Configures logging for a bucket.

Obtaining the Logging Configuration of a Bucket (SDK for Python)

ObsClient.getBucketLogging

Returns the logging configuration of a bucket.

Configuring a Bucket Policy (SDK for Python)

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 (SDK for Python)

ObsClient.getBucketPolicy

Returns the policy of a bucket.

Deleting a Bucket Policy (SDK for Python)

ObsClient.deleteBucketPolicy

Deletes the policy of a bucket.

Configuring Lifecycle Rules for a Bucket (SDK for Python)

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 (SDK for Python)

ObsClient.getBucketLifecycle

Returns the lifecycle configuration of a bucket.

Deleting the Lifecycle Configuration of a Bucket (SDK for Python)

ObsClient.deleteBucketLifecycle

Deletes all lifecycle rules of a bucket.

Configuring Static Website Hosting for a Bucket (SDK for Python)

ObsClient.setBucketWebsite

Configures static website hosting for a bucket.

Obtaining Static Website Hosting for a Bucket (SDK for Python)

ObsClient.getBucketWebsite

Returns the static website hosting configuration of a bucket.

Deleting Static Website Hosting for a Bucket (SDK for Python)

ObsClient.deleteBucketWebsite

Deletes the static website hosting configurations of a bucket.

Configuring Versioning for a Bucket (SDK for Python)

ObsClient.setBucketVersioning

Configures versioning for a bucket.

Obtaining the Versioning Status of a Bucket (SDK for Python)

ObsClient.getBucketVersioning

Returns the versioning status of a bucket.

Configuring CORS for a Bucket (SDK for Python)

ObsClient.setBucketCors

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

Obtaining the CORS Configuration of a Bucket (SDK for Python)

ObsClient.getBucketCors

Returns the CORS rules of a bucket.

Deleting the CORS Configuration of a Bucket (SDK for Python)

ObsClient.deleteBucketCors

Deletes the CORS configuration of a bucket.

Configuring Tags for a Bucket (SDK for Python)

ObsClient.setBucketTagging

Configures tags for a bucket.

Obtaining Bucket Tags (SDK for Python)

ObsClient.getBucketTagging

Returns the tags of a bucket.

Deleting Bucket Tags (SDK for Python)

ObsClient.deleteBucketTagging

Deletes the tags of a bucket.

Object Upload Overview (SDK for Python)

ObsClient.putContent

Uploads an object to a bucket.

Uploading an Object - File-Based (SDK for Python)

ObsClient.putFile

Uploads a file or folder to a bucket.

Uploading an Object - Append (SDK for Python)

ObsClient.appendObject

Appends content to an uploaded object.

Object Download Overview (SDK for Python)

ObsClient.getObject

Downloads an object from a bucket.

Copying an Object (SDK for Python)

ObsClient.copyObject

Creates a copy for a specified object.

Deleting an Object (SDK for Python)

ObsClient.deleteObject

Deletes a single object from a bucket.

Batch Deleting Objects (SDK for Python)

ObsClient.deleteObjects

Deletes multiple objects from a bucket in a batch.

Obtaining Object Metadata (SDK for Python)

ObsClient.getObjectMetadata

Returns the object metadata.

Modifying Object Metadata (SDK for Python)

ObsClient.setObjectMetadata

Modifies the metadata for an object.

Configuring an Object ACL (SDK for Python)

ObsClient.setObjectAcl

Configures the ACL for an object.

Obtaining an Object ACL (SDK for Python)

ObsClient.getObjectAcl

Returns the ACL of an object.

Initiating a Multipart Upload (SDK for Python)

ObsClient.initiateMultipartUpload

Initiates a multipart upload in a bucket.

Uploading a Part (SDK for Python)

ObsClient.uploadPart

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

Copying a Part (SDK for Python)

ObsClient.copyPart

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

Listing Uploaded Parts (SDK for Python)

ObsClient.listParts

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

Assembling Parts (SDK for Python)

ObsClient.completeMultipartUpload

Completes a multipart upload based on the multipart upload ID.

Aborting a Multipart Upload (SDK for Python)

ObsClient.abortMultipartUpload

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

Restoring an Archive Object

ObsClient.restoreObject

Restores an Archive object.

Creating a Signed URL (SDK for Python)

ObsClient.createSignedUrl

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

Creating Parameters for Browser-based Upload (SDK for Python)

ObsClient.createPostSignature

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

Uploading an Object - Resumable (SDK for Python)

ObsClient.uploadFile

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

Downloading an Object - Resumable (SDK for Python)

ObsClient.downloadFile

Adds the resumable function to the partial download API.