bucket.py 文件源码

python
阅读 43 收藏 0 点赞 0 评论 0

项目:django-gstorage 作者: fyndiq 项目源码 文件源码
def copydir(self, path):
        """
        Copy the contents of the local directory given by path to google cloud.
        Maintain the same directory structure on remote.
        This is (intentionally) a blocking call, so clients can report errors if
        the transfer fails.

        :type path: string
        :param path: relative or absolute path to the directory that needs to be copied
        :return: True when transfer is complete
        :raises OSError: path doesn't exist or permission denied
        :raises ValueError: if the library cannot determine the file size
        :raises gcloud.exceptions.GCloudError: if upload status gives error response
        """
        if not os.access(path, os.R_OK):
            raise OSError('Permission denied')
        for filename in find_files(path):
            blob = Blob(filename, self)
            blob.upload_from_filename(filename)
        return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号