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

Source code

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

OSS SDKs

OSS SDK for Python provides a variety of sample code for your reference or use. The following table describes the sample code provided.

Sample file Content
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, range download, and resumable download
object_check.py Data verification methods during uploads and downloads, including MD5 and CRC
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
sts.py How to use Security Token Service (STS), including obtaining a temporary user key by assuming RAM roles and using the obtained key to access OSS
live_channel.py Operations related to LiveChannel
image.py Operations related to IMG
bucket.py Basic operations on bucket, including creating, deleting, and listing buckets and configuring static website hosting and lifecycle rules
object_request_payment.py Enable pay-by-requester mode for buckets
traffic_limit.py Single-connection bandwidth throttling for object upload and download