ftpfs.py 文件源码

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

项目:pyfilesystem2 作者: PyFilesystem 项目源码 文件源码
def getbytes(self, path):
        _path = self.validatepath(path)
        data = io.BytesIO()
        with ftp_errors(self, path):
            with self._manage_ftp() as ftp:
                try:
                    ftp.retrbinary(
                        str("RETR ") + _encode(_path, self.ftp.encoding),
                        data.write
                    )
                except error_perm as error:
                    code, _ = _parse_ftp_error(error)
                    if code == 550:
                        if self.isdir(path):
                            raise errors.FileExpected(path)
                    raise

        data_bytes = data.getvalue()
        return data_bytes
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号