Get Public Bucket URL using boto3?

Hi, if my R2 bucket is enabled for public access, is there a way to use boto3 to retrieve the Public Bucket URL? I can then use the Public Bucket URL to construct the full URL to the object in this bucket.

Assume I know my endpoint url, access key id, access key and bucket name. Thanks!

Public buckets are not linked to the S3 API and aren’t available there - you’d have to hardcode them yourself or retrieve them from the Cloudflare API (look at the dashboard API calls, note they may change at any time).

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.