0
votes

The Google Cloud Storage bucket browser UI has a checkbox titled "Share publicly" which makes a blob downloadable by anyone.

The Python API has a way to check that box using make_public() (but not uncheck), and to get the resulting link using public_url(). It doesn't have an is_public().

How can you find out if a blob is publicly accessible?

1

1 Answers

3
votes

The closest I managed is

is_public = "READER" in blob.acl.all().get_roles()

which works, but it doesn't look like an official method. The string READER comes from a private constant, so may change in the future. Also blob.acl isn't documented as a way to fetch access control lists, only to create them.

So this works, but isn't very satisfactory.