I want to get a list of all the blobs in a Google Cloud Storage bucket using the Client Library for Python.
According to the documentation I should use the list_bl
It was a bit confusing, but I found the answer here
https://googlecloudplatform.github.io/google-cloud-python/latest/iterators.html
You can iterate through the pages and call the items needed
iterator=self.bucket.list_blobs()
self.get_files=[]
for page in iterator.pages:
print(' Page number: %d' % (iterator.page_number,))
print(' Items in page: %d' % (page.num_items,))
print(' First item: %r' % (next(page),))
print('Items remaining: %d' % (page.remaining,))
print('Next page token: %s' % (iterator.next_page_token,))
for f in page:
self.get_files.append("gs://" + f.bucket.name + "/" + f.name)
print( "Found %d results" % (len( self.get_files)))