Loading csst_dfs_client/__init__.py +3 −2 Original line number Diff line number Diff line from .version import __version__ from .common import request, fs from .common import request from io import BytesIO from .exceptions.exception import AppError __all__ = [ Loading @@ -20,7 +20,7 @@ def download_file(file_path: str) -> bytes: Raises: Exception: 如果下载失败,则抛出异常AppError。 """ response = request.download_file(f"/common/download/file?file_path={file_path}") response = request.download_file(f"/api/common/download/file?file_path={file_path}") if not response.ok: raise AppError("Failed to download the file. Reason: " + response.reason) return response.content Loading @@ -38,6 +38,7 @@ def read_file(file_path: str) -> BytesIO: Raises: Exception: 如果读取失败,则抛出异常AppError。 """ from .common import fs with fs.get_file_storage().read_file(file_path) as iobytes_io: try: iobytes_io.seek(0) Loading Loading
csst_dfs_client/__init__.py +3 −2 Original line number Diff line number Diff line from .version import __version__ from .common import request, fs from .common import request from io import BytesIO from .exceptions.exception import AppError __all__ = [ Loading @@ -20,7 +20,7 @@ def download_file(file_path: str) -> bytes: Raises: Exception: 如果下载失败,则抛出异常AppError。 """ response = request.download_file(f"/common/download/file?file_path={file_path}") response = request.download_file(f"/api/common/download/file?file_path={file_path}") if not response.ok: raise AppError("Failed to download the file. Reason: " + response.reason) return response.content Loading @@ -38,6 +38,7 @@ def read_file(file_path: str) -> BytesIO: Raises: Exception: 如果读取失败,则抛出异常AppError。 """ from .common import fs with fs.get_file_storage().read_file(file_path) as iobytes_io: try: iobytes_io.seek(0) Loading