def list_bucket_directory_mode(self, bucket): self.response.write('\nListbucket directory mode result:\n') for stat in gcs.listbucket(bucket + '/b', delimiter='/'): self.response.write('%r' % stat) self.response.write('\n') if stat.is_dir: for subdir_file in gcs.listbucket(stat.filename, delimiter='/'): self.response.write(' %r' % subdir_file) self.response.write('\n')
def list_bucket(self, bucket): self.response.write('\nListbucket result:\n') page_size = 1 stats = gcs.listbucket(bucket + '/foo', max_keys=page_size) while True: count = 0 for stat in stats: count += 1 self.response.write(repr(stat)) self.response.write('\n') if count != page_size or count == 0: break stats = gcs.listbucket(bucket + '/foo', max_keys=page_size, marker=stat.filename)