Skip to main content

一个支持阿里云OSS和MinIO的对象存储抽象包

Project description

FiuAI S3

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

特性

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

安装

pip install fiuai-s3

快速开始

初始化存储

from fiuai_s3 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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fiuai_s3-0.1.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fiuai_s3-0.1.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file fiuai_s3-0.1.0.tar.gz.

File metadata

  • Download URL: fiuai_s3-0.1.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for fiuai_s3-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fa007d7e9993500fb05c8a815b10e7ee2b9627dda77df57ab3c43ce9431931e8
MD5 85e8dcd6e8b92e62502c3d81998dcd47
BLAKE2b-256 ee62c93aa6e5fb865520cf479dcd90d15e46c9ec720e4145188dc8d7f5a4b8e8

See more details on using hashes here.

File details

Details for the file fiuai_s3-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fiuai_s3-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for fiuai_s3-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 32a3e14644270e26c35ff0310d8250ed3719e0b384162ad0d9d0967b97d6383d
MD5 60111c1f10341a7036f1de5fc798abe3
BLAKE2b-256 86f2c19394403f0207a95c36d14dd0bc8240700d09facd74f0e2c500b1001d07

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page