Exemple #1
0
class GoogleStorageManager(StorageManagerInterface):

    def __init__(self):
        self._gcp = GoogleCloudStorage()

    def _get_concrete_manager(self):
        return GoogleStorageManager()

    def delete(self, name):
        return self._gcp.delete(name)

    def exists(self, name):
        return self._gcp.exists(name)

    def listdir(self, path):
        return self._gcp.listdir(path)

    def open(self, name, mode='rb'):
        return self._gcp.open(name, mode=mode)

    def path(self, name):
        raise NotImplementedError

    def save(self, name, content, max_length=None):
        return self._gcp.save(name, content)

    def url(self, name):
        return self._gcp.url(name)

    def size(self, name):
        return self._gcp.size(name)

    def generate_filename(self, filename):
        return self._gcp.generate_filename(filename)
Exemple #2
0
 def open(self, mode='rb'):
     storage = GoogleCloudStorage(bucket_name=self.bucket_name())
     return storage.open(self.key(), mode=mode)