Skip to main content

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

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

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!

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_object_storage-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_object_storage-0.1.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fiuai_object_storage-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_object_storage-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0804fa009f1a2530dc6341f54a87fe5592f03b798431132144c14b1e5d9b555a
MD5 5e1d7a7d70759f0b93c5e5f4f4dbc924
BLAKE2b-256 a32bff070bd83fc4dc46448a96950e372884190d01269bec579e29240afae27a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fiuai_object_storage-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8de1ccf3a39f9d136d3e6fcfd6a1ae7100bc0766c005b9602b4f518d1c7e68af
MD5 13f137018b1d7324d4ffa4a8f265d8e5
BLAKE2b-256 bc31c15127ca23e67494a293afdfe5bdb6f3f1ab6aef585ccd58aa8d11ab8bfe

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