Skip to main content

MinIO Python Library for Amazon S3 Compatible Cloud Storage for Python

Project description

MinIO Python Library for Amazon S3 Compatible Cloud Storage Slack

The MinIO Python Client SDK provides simple APIs to access any Amazon S3 compatible object storage server.

This quickstart guide will show you how to install the client SDK and execute an example python program. For a complete list of APIs and examples, please take a look at the Python Client API Reference documentation.

This document assumes that you have a working Python setup in place.

Minimum Requirements

  • Python 2.7 or higher

Download from pip

pip install minio

Download from pip3

pip3 install minio

Download from source

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

Initialize MinIO Client

You need four items in order to connect to MinIO object storage server.

Params Description
endpoint URL to object storage service.
access_key Access key is like user ID that uniquely identifies your account.
secret_key Secret key is the password to your account.
secure Set this value to 'True' to enable secure (HTTPS) access.
from minio import Minio
from minio.error import ResponseError

minioClient = Minio('play.min.io',
                  access_key='Q3AM3UQ867SPQQA43P2F',
                  secret_key='zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
                  secure=True)

NOTE on concurrent usage: The Minio object is thread safe when using the Python threading library. Specifically, it is NOT safe to share it between multiple processes, for example when using multiprocessing.Pool. The solution is simply to create a new Minio object in each process, and not share it between processes.

Quick Start Example - File Uploader

This example program connects to a MinIO object storage server, makes a bucket on the server and then uploads a file to the bucket.

We will use the MinIO server running at https://play.min.io in this example. Feel free to use this service for testing and development. Access credentials shown in this example are open to the public.

file-uploader.py

# Import MinIO library.
from minio import Minio
from minio.error import (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")
except BucketAlreadyOwnedByYou as err:
       pass
except BucketAlreadyExists as err:
       pass
except ResponseError as err:
       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')
except ResponseError as err:
       print(err)

Run file-uploader

python file_uploader.py

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

API Reference

The full API Reference is available here.

API Reference : Bucket Operations

API Reference : Bucket policy Operations

API Reference : Bucket notification Operations

API Reference : Default bucket encryption configuration Operations

API Reference : File Object Operations

API Reference : Object Operations

API Reference : Presigned Operations

Full Examples

Full Examples : Bucket Operations

Full Examples : Bucket policy Operations

Full Examples: Bucket notification Operations

Full Examples: Default bucket encryption configuration Operations

Full Examples : File Object Operations

Full Examples : Object Operations

Full Examples : Presigned Operations

Explore Further

Contribute

Contributors Guide

PYPI Build Status Build status

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

minio-6.0.2.tar.gz (114.2 kB view details)

Uploaded Source

Built Distributions

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

minio-6.0.2-py3.6.egg (146.7 kB view details)

Uploaded Egg

minio-6.0.2-py2.py3-none-any.whl (73.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file minio-6.0.2.tar.gz.

File metadata

  • Download URL: minio-6.0.2.tar.gz
  • Upload date:
  • Size: 114.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.9

File hashes

Hashes for minio-6.0.2.tar.gz
Algorithm Hash digest
SHA256 acae9bfae0aec1b92025bd63e18135ebb4994c84600716c5323e14cb0c9a0b03
MD5 09e70a98e487ba1e3489d13cc3f37e45
BLAKE2b-256 992d9b852055755422fb9ea9cee07678fb484e333ff62a6298ccb322e61fac8f

See more details on using hashes here.

File details

Details for the file minio-6.0.2-py3.6.egg.

File metadata

  • Download URL: minio-6.0.2-py3.6.egg
  • Upload date:
  • Size: 146.7 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.9

File hashes

Hashes for minio-6.0.2-py3.6.egg
Algorithm Hash digest
SHA256 7cb075b56bac894551304cb824f958069a84e0dd2d0a685f9bed3c05e15727bf
MD5 b20501ad537ff22a40b2eeefb2cd5c5c
BLAKE2b-256 8746ec794f5fbad709439eb9cc6bab66a1727428cb15c1ab65db408f70c6ec3f

See more details on using hashes here.

File details

Details for the file minio-6.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: minio-6.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 73.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.9

File hashes

Hashes for minio-6.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 eec4ab073ff979c34e928e532d8acc1d40d61ba4404709cf27ab3ecdcfa2a561
MD5 2e5b319629be77d8fe1ee1dfbb192602
BLAKE2b-256 9e6f3df7e07e2b1642049a0d00e33e11b406d1d4686bd1f8ddb56962978c3653

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