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.py
bucket_cname.pyMap custom domain names
bucket_cors.pyCORS
bucket_inventory.pyBucket inventories
bucket_logging.pyLogging
bucket_meta_query.pyData indexing
bucket_policy.pyBucket policies
bucket_referer.pyHotlink protection
bucket_replication.pyCRR
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
download.py
image.pyIMG
object_basic.py
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_operation.py
object_post.pyForm upload
object_progress.py
object_request_payment.pyPay-by-requester
object_restore.pyRestore objects
server_side_encryption.pyServer-side encryption
object_storage_type.pyConvert the storage classes of objects
sts.pyAuthorized access
object_tagging.py
select_csv.pyQuery objects
traffic_limit.pySingle-connection bandwidth throttling
upload.py