def is_accessible_bucket_name(bucket_name):
 scope = 'https://www.googleapis.com/auth/devstorage.read_write'
 url = ('https://%s.commondatastorage.googleapis.com/' % bucket_name)
 (auth_token, _) = app_identity.get_access_token(scope)
 result = urlfetch.fetch(url, method=urlfetch.HEAD, headers={'Authorization': ('OAuth %s' % auth_token), 'x-goog-api-version': '2'})
 return (result and (result.status_code == 200))

def is_accessible_bucket_name ( bucket_name ) : scope = 'https://www.googleapis.com/auth/devstorage.read_write' url = ( 'https://%s.commondatastorage.googleapis.com/' % bucket_name ) ( auth_token , _ ) = app_identity . get_access_token ( scope ) result = urlfetch . fetch ( url , method = urlfetch . HEAD , headers = { 'Authorization' : ( 'OAuth %s' % auth_token ) , 'x-goog-api-version' : '2' } ) return ( result and ( result . status_code == 200 ) )
returns true if the application has access to the specified bucket .