Skip to main content

MinIO Python SDK for Amazon S3 Compatible Cloud Storage

Project description

MinIO Python SDK for Amazon S3 Compatible Cloud Storage Slack

MinIO Python SDK is Simple Storage Service (aka S3) client to perform bucket and object operations to any Amazon S3 compatible object storage service.

For a complete list of APIs and examples, please take a look at the Python Client API Reference

Minimum Requirements

Python 3.6 or higher.

Download using pip

pip3 install minio

Download source

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

Quick Start Example - File Uploader

This example program connects to an S3-compatible object storage server, make a bucket on that server, and upload a file to the bucket.

You need the following items to connect to an S3-compatible object storage server:

Parameters Description
Endpoint URL to S3 service.
Access Key Access key (aka user ID) of an account in the S3 service.
Secret Key Secret key (aka password) of an account in the S3 service.

This example uses MinIO server playground https://play.min.io. Feel free to use this service for test and development.

file_uploader.py

from minio import Minio
from minio.error import S3Error


def main():
    # Create a client with the MinIO server playground, its access key
    # and secret key.
    client = Minio(
        "play.min.io",
        access_key="Q3AM3UQ867SPQQA43P2F",
        secret_key="zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG",
    )

    # Make 'asiatrip' bucket if not exist.
    found = client.bucket_exists("asiatrip")
    if not found:
        client.make_bucket("asiatrip")
    else:
        print("Bucket 'asiatrip' already exists")

    # Upload '/home/user/Photos/asiaphotos.zip' as object name
    # 'asiaphotos-2015.zip' to bucket 'asiatrip'.
    client.fput_object(
        "asiatrip", "asiaphotos-2015.zip", "/home/user/Photos/asiaphotos.zip",
    )
    print(
        "'/home/user/Photos/asiaphotos.zip' is successfully uploaded as "
        "object 'asiaphotos-2015.zip' to bucket 'asiatrip'."
    )


if __name__ == "__main__":
    try:
        main()
    except S3Error as exc:
        print("error occurred.", exc)

Run File Uploader

$ python file_uploader.py
'/home/user/Photos/asiaphotos.zip' is successfully uploaded as object 'asiaphotos-2015.zip' to bucket 'asiatrip'.

$ mc ls play/asiatrip/
[2016-06-02 18:10:29 PDT]  82KiB asiaphotos-2015.zip

More References

Explore Further

Contribute

Please refer Contributors Guide

PYPI

Project details


Release history Release notifications | RSS feed

This version

7.1.0

Download files

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

Source Distribution

minio-7.1.0.tar.gz (115.0 kB view details)

Uploaded Source

Built Distribution

minio-7.1.0-py3-none-any.whl (75.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: minio-7.1.0.tar.gz
  • Upload date:
  • Size: 115.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.5

File hashes

Hashes for minio-7.1.0.tar.gz
Algorithm Hash digest
SHA256 90b853a48422240028d0720668808d2cc7498b5f843271b533ba6fa91e3e3797
MD5 9b1f72e1a51c7aeb35dca66269901b7d
BLAKE2b-256 5488a2b288e63b4dc724a89197ea5903ba43a3eecd17670d5322fd50a6d4b37a

See more details on using hashes here.

File details

Details for the file minio-7.1.0-py3-none-any.whl.

File metadata

  • Download URL: minio-7.1.0-py3-none-any.whl
  • Upload date:
  • Size: 75.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.5

File hashes

Hashes for minio-7.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c78d5559b3c37b0b3a09983aade272d6ec2a437e02335a44949f30000e5e46a4
MD5 8ed0e1fdb05f5a4e50394dce8bc9ef51
BLAKE2b-256 b3b44281ab6be6c7bae210b86956fc2d71e0848f2a37e95f102401fc1317529f

See more details on using hashes here.

Supported by

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