MinIO Python Library for Amazon S3兼容云存储for Python

ak-minio的Python项目详细描述


适用于Amazon S3兼容云存储的MinIO Python库Slack

miniopython客户机SDK提供了访问任何amazons3兼容对象存储服务器的简单api。在

本快速入门指南将向您展示如何安装客户机SDK和执行示例python程序。有关api和示例的完整列表,请查看Python Client API Reference文档。在

本文档假定您有一个正在工作的Python设置。在

最低要求

  • Python 2.7或更高版本

从pip下载

pip install minio

从pip3下载

^{pr2}$

从源下载

git clone https://github.com/minio/minio-py
cd minio-py
python setup.py install

初始化MinIO客户端

您需要四个项目才能连接到MinIO对象存储服务器。在

ParamsDescription
endpointURL to object storage service.
access_keyAccess key is like user ID that uniquely identifies your account.
secret_keySecret key is the password to your account.
secureSet this value to 'True' to enable secure (HTTPS) access.
fromminioimportMiniofromminio.errorimportResponseErrorminioClient=Minio('play.min.io',access_key='Q3AM3UQ867SPQQA43P2F',secret_key='zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',secure=True)

快速入门示例-文件上载程序

这个示例程序连接到一个MinIO对象存储服务器,在服务器上创建一个bucket,然后将一个文件上载到bucket。在

在本例中,我们将使用运行在https://play.min.io的MinIO服务器。请随意使用此服务进行测试和开发。此示例中显示的访问凭据对公众开放。在

文件-上传器.py

# Import MinIO library.fromminioimportMiniofromminio.errorimport(ResponseError,BucketAlreadyOwnedByYou,BucketAlreadyExists)# Initialize minioClient with an endpoint and access/secret keys.minioClient=Minio('play.min.io',access_key='Q3AM3UQ867SPQQA43P2F',secret_key='zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',secure=True)# Make a bucket with the make_bucket API call.try:minioClient.make_bucket("maylogs",location="us-east-1")exceptBucketAlreadyOwnedByYouaserr:passexceptBucketAlreadyExistsaserr:passexceptResponseErroraserr:raise# Put an object 'pumaserver_debug.log' with contents from 'pumaserver_debug.log'.try:minioClient.fput_object('maylogs','pumaserver_debug.log','/tmp/pumaserver_debug.log')exceptResponseErroraserr:print(err)

运行文件上载程序

python file_uploader.py

mc ls play/maylogs/
[2016-05-27 16:41:37 PDT]  12MiB pumaserver_debug.log

API参考

这里提供完整的API参考。在

API参考:Bucket操作

API参考:存储桶策略操作

API引用:Bucket通知操作

文件操作

API引用:对象操作

API参考:预签名操作

完整的例子

完整示例:Bucket操作

完整示例:Bucket策略操作

完整示例:Bucket通知操作

完整示例:文件对象操作

完整示例:对象操作

完整示例:预签名操作

进一步探索

贡献

Contributors Guide

PYPIBuild StatusBuild status

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
我们可以使用java for loop with switch语句。。?   java如何从具有循环关系的数据集生成树?   使用s:mvcUrl标记时java Spring启动问题   javascript Wicket调色板水平滚动条在firefox中不显示   java如何清理Maven插件绑定?   java将文件从设备发送到计算机不起作用(文件被破坏)   Java GPU编程的性能   java字符串标记器问题   连接Java LDAP断开连接   java Android GridView将无法确定正确的位置   java AlarmManager在指定时间未显示toast消息   MVC中的java测试外观|断言返回类型   logcat上的java Android运行时错误   java Building Workspace在Eclipse中遇到错误   堆栈溢出尾部递归遗传算法抛出“awteventque0”java。StackOverflowerr语言   java ArrayOutOfBounds测试代码不工作   java有没有像Moodle这样流行的课程管理系统?   java如何从jsp获取xml文件作为响应