Coder Social home page Coder Social logo

nevesenin / minio-py Goto Github PK

View Code? Open in Web Editor NEW

This project forked from minio/minio-py

0.0 2.0 0.0 2.16 MB

MinIO Client SDK for Python

Home Page: https://docs.min.io/docs/python-client-quickstart-guide.html

License: Apache License 2.0

Python 99.43% Makefile 0.14% Shell 0.43%

minio-py's Introduction

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

minio-py's People

Contributors

fkautz avatar harshavardhana avatar balamurugana avatar minio-trusted avatar vadmeste avatar ebozduman avatar donatello avatar kannappanr avatar koolhead17 avatar poornas avatar krishnasrinivas avatar praveenrajmani avatar deekoder avatar krisis avatar hardbyte avatar brianhelba avatar indradhanush avatar smouli avatar dhilipsiva avatar kadenlnelson avatar tirkarthi avatar febg avatar drjackild avatar dtaniwaki avatar chillaranand avatar waydotnet avatar vsoch avatar urandu avatar tkislan avatar t0ad avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.