Enable the pay-by-requester mode using OSS SDK for Python 2.0
Pay-by-requester is supported. When pay-by-requester is enabled for a bucket, the requester pays the request and traffic fees, and the bucket owner pays the storage costs. You can enable pay-by-requester for a bucket to share data in the bucket without paying for the request and traffic fees when your bucket is accessed.
Usage notes
-
The sample code in this topic uses the region ID
cn-hangzhouof the China (Hangzhou) region. By default, a public endpoint is used to access resources in a bucket. If you want to access resources in the bucket from other Alibaba Cloud services in the same region in which the bucket is located, use an internal endpoint. For more information about the regions and endpoints that OSS supports, see Regions and endpoints. -
To set the pay-by-requester mode, you must have the
oss:PutBucketRequestPaymentpermission. To retrieve the pay-by-requester mode configuration, you must have theoss:GetBucketRequestPaymentpermission. For more information, see Grant custom permissions to a RAM user.
Sample code
References
-
For the complete sample code that is used to set the pay-by-requester mode, see put_bucket_request_payment.py.
-
For the complete sample code that is used to retrieve the pay-by-requester mode configuration, see get_bucket_request_payment.py.