Skip to main content

Everything you need to use MinIO in flask

Project description

Flask And MinIO

FlaskAndMinio allows you to easily use MinIO in your Flask projects and offers some features to improve and ease things.

Install

You can either download the source code of this repository or install it via pip:

pip install flask-and-minio

Usage

You can add it to your program in the following two ways:

from flask import Flask
from flask_and_minio import FlaskAndMinio

app = Flask(__name__)
app.config['MINIO_ENDPOINT'] = 'localhost:9000'
app.config['MINIO_ACCESS_KEY	'] = 'minioadmin'
app.config['MINIO_SECRET_KEY'] = 'minioadmin'
minio = FlaskAndMinio(app)

mc = minio.get_client() # This client method returns the minio for direct use
minio.get_url('bucket', 'object-name.png')
minio.remove_file('bucket', 'object-name.png')

Or:

from flask import Flask
from flask_and_minio import FlaskAndMinio

app = Flask(__name__)
minio = FlaskAndMinio()
app.config['MINIO_ENDPOINT'] = 'localhost:9000'
app.config['MINIO_ACCESS_KEY	'] = 'minioadmin'
app.config['MINIO_SECRET_KEY'] = 'minioadmin'
minio.init_app(app)

mc = minio.get_client() # This client method returns the minio for direct use
minio.get_url('bucket', 'object-name.png')
minio.remove_file('bucket', 'object-name.png')

Configurations:

Variable Default value Description
MINIO_ENDPOINT localhost:9000 URL to S3 service.
MINIO_ACCESS_KEY minioadmin Access key (aka user ID) of an account in the S3 service.
MINIO_SECRET_KEY minioadmin Secret key (aka password) of an account in the S3 service.
MINIO_SECURE True Use HTTPS.
MINIO_REGION None Set region.
MINIO_HTTP_CLIENT None Customized HTTP client.
MINIO_LOAD_BALANCER_URL None If you use load balancer for s3, you can have urls with this domain by setting this value

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

flask_and_minio-0.0.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file flask_and_minio-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_and_minio-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0a514c1a0163d16858b03468ac3775d5e8293bd24c0a90d67bb5d00f5d6b0316
MD5 37fb88b6431f0f9bb3c4d8ec8f14c31b
BLAKE2b-256 9531d1cf40e1b414abf45f4b5b7980ee2c12a8935e7dd37c63d901eaab1eea85

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 Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page