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 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 Quick start, including creating a bucket and uploading, downloading, listing, and deleting objects Upload and manage objects, including managing object metadata, copying objects, and append upload Upload objects, including resumable upload and multipart upload Download objects, including streaming download, range download, and resumable download Data verification methods during uploads and downloads, including MD5 and CRC Upload progress bars and download progress bars Upload callback after an object is uploaded Operations related to form upload 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 Operations related to LiveChannel Operations related to IMG Basic operations on bucket, including creating, deleting, and listing buckets and configuring static website hosting and lifecycle rules Enable pay-by-requester mode for buckets Single-connection bandwidth throttling for object upload and download