Minio Cloud storage API for Web/App[Part-2 : Minio with Python ]

SanjayKhanSSK
2 min readMar 8, 2020

Minio API supports many languages like Python,Java,Go,JS,.Net,etc…

Photo by Max Duzij on Unsplash

Getting Started

I think you have running the docker if you have read Part-1 of this series

Now Let’s start with pip install,Open up terminal

pip3 install minio (I have already installed so my output will be)

Requirement already satisfied: minio in ./.local/lib/python3.7/site-packages (5.0.7)
Requirement already satisfied: pytz in /usr/lib/python3/dist-packages (from minio) (2019.2)
Requirement already satisfied: python-dateutil in /usr/lib/python3/dist-packages (from minio) (2.7.3)
Requirement already satisfied: urllib3 in /usr/lib/python3/dist-packages (from minio) (1.24.1)
Requirement already satisfied: certifi in /usr/lib/python3/dist-packages (from minio) (2018.8.24)
Requirement already satisfied: configparser in ./.local/lib/python3.7/site-packages (from minio) (4.0.2)

Ok, you can use your favorite IDE (vscode,pycharm,atom anything you want).But I’m going to use the CLI of python 3.

1.Connecting to minio

from minio import MiniominioClient = Minio('172.17.0.2:9000',
access_key='minioadmin',
secret_key='minioadmin',
secure=False )

Host=172.17.0.2:9000 #the IP we have opened in browser,you can give any cloud storage IP

secure=False #if you’re connecting to https set it True

secret_key - SECRET_KEY to connect
access_key -Access_KEY to connect

2.Creating Bucket:

minioClient.make_bucket("python")

If you checkout browser(refresh)

we have created bucket

3.Uploading File

#minioClient.fput_object(bucket,file_name_to_save,local_path)
minioClient.fput_object('python', 'testing.png', '/home/ssk/Pictures/inkscape/laptop2.png',content_type='image/png')
Image uploaded

Wow that’s very easy so we have uploaded image via python but this is not enough when we scaling a long we need Folders , nested file structures , Downloading file,Delete file.

In the next Part we’ll see how to

  1. Download Image via Python
  2. Creating folder via Python
  3. Deleting file via Python

--

--