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为什么这一行是charg=(char)(br.read());被跳过?   java三重DES中的IV在哪里?   java Lombok注释不在Intellij idea下编译   java为什么我不能使用过滤器作为流中的最后一步   sqlite Java编译错误找不到符号方法next()   在Java中解析处理对int来说太大的数字   java摄像头不工作   java是“断言错误”好的做法?   java确定api请求是来自CURL还是POSTMAN?   JavaSpringMVC导航   java使单例模式代码更强大   当Java(解释器)区分大小写时,为什么Java编译器(javac)不区分大小写?   java注释字符串[]oneArr();vs字符串[][]twoArr();公告   java命名查询的利弊   java使用log4jweb在web应用程序中配置Log4j2。罐子   java正则表达式查找以开头和结尾的所有可能出现的文本~   java从字符串执行方法