This topic provides the sample code of Object Storage Service (OSS) SDK for Python in various use cases.

Source code

For more information about the source code of OSS SDK for Python, visit GitHub.

Sample code

OSS SDK for Python provides various sample code files for your reference or use. The following table describes the sample code files provided by OSS SDK for Python.

Sample code file Content
bucket.py
bucket_inventory.py Bucket inventory
bucket_policy.py Bucket policy
object_request_payment.py Enable pay-by-requester mode for buckets
object_basic.py Quick start, including creating a bucket and uploading, downloading, listing, and deleting objects
object_extra.py Upload and manage objects, including managing object metadata, copying objects, and append upload.
upload.py Upload objects, including resumable upload and multipart upload.
download.py Download objects, including streaming download, downloading an object to a local file, range download, and resumable download.
object_progress.py Upload progress bars and Download progress bars
object_callback.py Upload callback after an object is uploaded
object_post.py Operations related to form upload
object_basic.py List objects and Delete objects
select_csv.py Query objects
traffic_limit.py Single-connection bandwidth throttling for object upload and download
object_crypto.py Client-side encryption
object_server_crypto.py Server-side encryption
sts.py Authorized access and use of Security Token Service (STS), including obtaining a temporary credential by assuming a RAM role and using the obtained temporary credential to access OSS
object_check.py Data verification methods (including MD5 and CRC) during object upload and download and data security
image.py Operations related to Image Processing (IMG)
live_channel.py Operations related to LiveChannel