def list_bucket_files(bucket_name, prefix, max_keys=1000):
 scope = 'https://www.googleapis.com/auth/devstorage.read_only'
 url = ('https://%s.commondatastorage.googleapis.com/?' % bucket_name)
 query = [('max-keys', max_keys)]
 if prefix:
  query.append(('prefix', prefix))
 url += urllib.urlencode(query)
 (auth_token, _) = app_identity.get_access_token(scope)
 result = urlfetch.fetch(url, method=urlfetch.GET, headers={'Authorization': ('OAuth %s' % auth_token), 'x-goog-api-version': '2'})
 if (result and (result.status_code == 200)):
  doc = xml.dom.minidom.parseString(result.content)
  return [node.childNodes[0].data for node in doc.getElementsByTagName('Key')]
 raise BackupValidationException('Request to Google Cloud Storage failed')

def list_bucket_files ( bucket_name , prefix , max_keys = 1000 ) : scope = 'https://www.googleapis.com/auth/devstorage.read_only' url = ( 'https://%s.commondatastorage.googleapis.com/?' % bucket_name ) query = [ ( 'max-keys' , max_keys ) ] if prefix : query . append ( ( 'prefix' , prefix ) ) url += urllib . urlencode ( query ) ( auth_token , _ ) = app_identity . get_access_token ( scope ) result = urlfetch . fetch ( url , method = urlfetch . GET , headers = { 'Authorization' : ( 'OAuth %s' % auth_token ) , 'x-goog-api-version' : '2' } ) if ( result and ( result . status_code == 200 ) ) : doc = xml . dom . minidom . parseString ( result . content ) return [ node . childNodes [ 0 ] . data for node in doc . getElementsByTagName ( 'Key' ) ] raise BackupValidationException ( 'Request to Google Cloud Storage failed' )
returns a listing of of a bucket that matches the given prefix .