Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

FiuAI Object Storage

一个支持阿里云OSS和MinIO的对象存储抽象包,提供了统一的接口来操作不同的对象存储服务。

特性

  • 支持阿里云OSS和MinIO存储服务
  • 统一的接口设计
  • 工厂模式实现,易于扩展
  • 完整的类型提示
  • 详细的日志记录
  • 异常处理机制

安装

pip install fiuai-object-storage

快速开始

初始化存储

from object_storage import ObjectStorageFactory

# 初始化MinIO存储
ObjectStorageFactory.initialize(
    provider="minio",
    bucket_name="dev",
    endpoint="http://127.0.0.1:19000",
    access_key="devdevdev",
    secret_key="devdevdev",
    temp_dir="temp/",
    use_https=False
)

# 或者初始化阿里云OSS存储
ObjectStorageFactory.initialize(
    provider="alicloud",
    bucket_name="your-bucket",
    endpoint="oss-cn-hangzhou.aliyuncs.com",
    access_key="your-access-key",
    secret_key="your-secret-key",
    temp_dir="temp/",
    use_https=True
)

使用存储实例

# 获取存储实例
storage = ObjectStorageFactory.get_instance()

# 上传文件
storage.upload_file("test.txt", b"Hello World")

# 下载文件
data = storage.download_file("test.txt")

# 删除文件
storage.delete_file("test.txt")

# 列出文件
files = storage.list_files(prefix="test/")

配置参数

参数 类型 必填 默认值 说明
provider str 是 - 存储提供商,支持 "alicloud" 或 "minio"
bucket_name str 是 - 存储桶名称
endpoint str 是 - 存储服务端点
access_key str 是 - 访问密钥
secret_key str 是 - 密钥
temp_dir str 否 "temp/" 临时目录
use_https bool 否 False 是否使用HTTPS

开发

安装开发依赖

pip install -r requirements.txt

运行测试

python -m pytest tests/

许可证

MIT License

作者

贡献

欢迎提交 Issue 和 Pull Request!

Metadata

Release files for fiuai-object-storage 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fiuai-object-storage 0.1.0
File Size Uploaded
fiuai_object_storage-0.1.0.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fiuai-object-storage 0.1.0
File Interpreter ABI Platform
fiuai_object_storage-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.4 kB

Release files / fiuai_object_storage-0.1.0.tar.gz

Download URL fiuai_object_storage-0.1.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0804fa009f1a2530dc6341f54a87fe5592f03b798431132144c14b1e5d9b555a
BLAKE2b-256 checksum
How to use checksums
a32bff070bd83fc4dc46448a96950e372884190d01269bec579e29240afae27a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release files / fiuai_object_storage-0.1.0-py3-none-any.whl

Download URL fiuai_object_storage-0.1.0-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8de1ccf3a39f9d136d3e6fcfd6a1ae7100bc0766c005b9602b4f518d1c7e68af
BLAKE2b-256 checksum
How to use checksums
bc31c15127ca23e67494a293afdfe5bdb6f3f1ab6aef585ccd58aa8d11ab8bfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page