In pay-by-requester mode, requesters pay the traffic and request fees that are generated when they read data from a bucket. The bucket owner pays only the storage fees. You can enable this feature if you want to share data without incurring additional traffic and request fees.
Precautions
The sample code in this topic uses the China (Hangzhou) region as an example. The region ID is
cn-hangzhou. Public endpoints are used by default. If you want to access OSS from other Alibaba Cloud services in the same region as OSS, use internal endpoints. For more information about the regions and endpoints that are supported by OSS, see OSS 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.