fiuai-s3 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fiuai-s3 might be problematic. Click here for more details.
- fiuai_s3/object_storage.py +1 -2
- {fiuai_s3-0.1.0.dist-info → fiuai_s3-0.1.1.dist-info}/METADATA +21 -26
- {fiuai_s3-0.1.0.dist-info → fiuai_s3-0.1.1.dist-info}/RECORD +5 -5
- {fiuai_s3-0.1.0.dist-info → fiuai_s3-0.1.1.dist-info}/WHEEL +0 -0
- {fiuai_s3-0.1.0.dist-info → fiuai_s3-0.1.1.dist-info}/licenses/LICENSE +0 -0
fiuai_s3/object_storage.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fiuai-s3
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: 一个支持阿里云OSS和MinIO的对象存储抽象包
|
|
5
5
|
Project-URL: Homepage, https://github.com/fiuai-sz/fiuai-s3
|
|
6
6
|
Project-URL: Repository, https://github.com/fiuai-sz/fiuai-s3.git
|
|
@@ -247,48 +247,43 @@ pip install fiuai-s3
|
|
|
247
247
|
### 初始化存储
|
|
248
248
|
|
|
249
249
|
```python
|
|
250
|
+
# file: utils/s3.py
|
|
250
251
|
from fiuai_s3 import ObjectStorageFactory
|
|
252
|
+
from config.app_config import get_settings
|
|
251
253
|
|
|
252
|
-
# 初始化MinIO存储
|
|
253
254
|
ObjectStorageFactory.initialize(
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
255
|
+
# 初始化对象存储
|
|
256
|
+
provider=get_settings().object_storage_config.provider,
|
|
257
|
+
bucket_name=get_settings().object_storage_config.bucket_name,
|
|
258
|
+
endpoint=get_settings().object_storage_config.endpoint,
|
|
259
|
+
access_key=get_settings().object_storage_config.access_key,
|
|
260
|
+
secret_key=get_settings().object_storage_config.secret_key,
|
|
261
|
+
temp_dir=get_settings().object_storage_config.s3_temp_dir,
|
|
262
|
+
use_https=get_settings().object_storage_config.s3_use_https
|
|
263
|
+
|
|
261
264
|
)
|
|
265
|
+
S3_Client = ObjectStorageFactory.get_instance()
|
|
262
266
|
|
|
263
|
-
# 或者初始化阿里云OSS存储
|
|
264
|
-
ObjectStorageFactory.initialize(
|
|
265
|
-
provider="alicloud",
|
|
266
|
-
bucket_name="your-bucket",
|
|
267
|
-
endpoint="oss-cn-hangzhou.aliyuncs.com",
|
|
268
|
-
access_key="your-access-key",
|
|
269
|
-
secret_key="your-secret-key",
|
|
270
|
-
temp_dir="temp/",
|
|
271
|
-
use_https=True
|
|
272
|
-
)
|
|
273
267
|
```
|
|
274
268
|
|
|
269
|
+
|
|
275
270
|
### 使用存储实例
|
|
276
271
|
|
|
277
272
|
```python
|
|
278
|
-
#
|
|
279
|
-
|
|
273
|
+
# file: app.py
|
|
274
|
+
from utils.s3 import S3_Client
|
|
280
275
|
|
|
281
276
|
# 上传文件
|
|
282
|
-
|
|
277
|
+
S3_Client.upload_file("test.txt", b"Hello World")
|
|
283
278
|
|
|
284
279
|
# 下载文件
|
|
285
|
-
data =
|
|
280
|
+
data = S3_Client.download_file("test.txt")
|
|
286
281
|
|
|
287
282
|
# 删除文件
|
|
288
|
-
|
|
283
|
+
S3_Client.delete_file("test.txt")
|
|
289
284
|
|
|
290
285
|
# 列出文件
|
|
291
|
-
files =
|
|
286
|
+
files = S3_Client.list_files(prefix="test/")
|
|
292
287
|
```
|
|
293
288
|
|
|
294
289
|
## 配置参数
|
|
@@ -308,7 +303,7 @@ files = storage.list_files(prefix="test/")
|
|
|
308
303
|
### 安装开发依赖
|
|
309
304
|
|
|
310
305
|
```bash
|
|
311
|
-
pip install
|
|
306
|
+
uv pip install .
|
|
312
307
|
```
|
|
313
308
|
|
|
314
309
|
### 运行测试
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
fiuai_s3/__init__.py,sha256=SZNl4Ohwf19PLyjRjIASpzhg3rvutd1WbLpblz_8G3s,312
|
|
2
|
-
fiuai_s3/object_storage.py,sha256=
|
|
2
|
+
fiuai_s3/object_storage.py,sha256=OKwgJrljj9n5wx4LDQ8xmI04e9h_FDtpvrUnf82jV7c,5488
|
|
3
3
|
fiuai_s3/alicloud/__init__.py,sha256=mmrCrFp5DzRF5fViJDq7_LpsqCViwTPXOPz4qoaSscI,218
|
|
4
4
|
fiuai_s3/alicloud/alicloud_storage.py,sha256=-OS3sArg3znY8Hf341RuuSeJb5YYkxuNOnk-17K7ppA,2971
|
|
5
5
|
fiuai_s3/minio/__init__.py,sha256=hOmpUkTq8TPgYOxfeOMcWq1_YsJ2r8Zf9VTX3w_v1Lk,209
|
|
6
6
|
fiuai_s3/minio/minio_storage.py,sha256=tt8N1PMw7rZoL8uUqH1AMqBa-6c82HyUi4_Um4kv21Q,4446
|
|
7
|
-
fiuai_s3-0.1.
|
|
8
|
-
fiuai_s3-0.1.
|
|
9
|
-
fiuai_s3-0.1.
|
|
10
|
-
fiuai_s3-0.1.
|
|
7
|
+
fiuai_s3-0.1.1.dist-info/METADATA,sha256=VvlN7Lvz-QGkFFN-StCfXbb9x69mSsddRLePtLBgHp4,16035
|
|
8
|
+
fiuai_s3-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
9
|
+
fiuai_s3-0.1.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
10
|
+
fiuai_s3-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|