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 fileContent
bucket_cname.pyMap custom domain names
bucket_inventory.pyBucket inventories
bucket_meta_query.pyData indexing
bucket_policy.pyBucket policies
bucket_referer.pyHotlink protection
bucket_symlink.pyManage symbolic links
bucket_tagging.pyBucket tagging
bucket_transfer_acceleration.pyTransfer acceleration
bucket_versioning.pyManage versioning
bucket_website.pyStatic website hosting (mirroring-based back-to-origin)
bucket_worm.pyRetention policies
object_callback.pyUpload callback
object_check.pyData security
object_crypto.pyClient-side encryption
object_extra.pyManage object metadata
object_forbid_overwrite.pyPrevent objects from being overwritten by objects that have the same names
object_post.pyForm upload
object_restore.pyRestore objects
server_side_encryption.pyServer-side encryption
object_storage_type.pyConvert the storage classes of objects
sts.pyAuthorized access
select_csv.pyQuery objects
traffic_limit.pySingle-connection bandwidth throttling