예제 #1
0
 def list_bucket_directory_mode(self, bucket):
     self.response.write('Listbucket 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')
예제 #2
0
    def list_bucket(self, bucket):
        """Create several files and paginate through them.

        Production apps should set page_size to a practical value.

        Args:
          bucket: bucket.
        """
        self.response.write('Listbucket 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
            # pylint: disable=undefined-loop-variable
            stats = gcs.listbucket(bucket + '/foo', max_keys=page_size, marker=stat.filename)