taolib.testing.file_storage.client#
轻量级客户端 SDK。
提供同步和异步的文件存储访问接口。
Classes#
文件存储客户端。 |
Module Contents#
- class taolib.testing.file_storage.client.FileStorageClient(base_url: str = 'http://localhost:8002', token: str | None = None, timeout: float = 30.0)#
文件存储客户端。
- _base_url = ''#
- _timeout = 30.0#
- _client() httpx.Client#
- _async_client() httpx.AsyncClient#
- upload_file(bucket_id: str, file_path: str | pathlib.Path, object_key: str, content_type: str | None = None) dict[str, Any]#
上传文件。
自动根据文件大小选择简单上传或分片上传。
- download_file(file_id: str, dest_path: str | pathlib.Path) pathlib.Path#
下载文件。
- init_upload(bucket_id: str, object_key: str, filename: str, content_type: str, total_size_bytes: int, chunk_size_bytes: int = 5 * 1024 * 1024) dict[str, Any]#
初始化分片上传。