A package, which provides easy usage for minio with flask
Project description
Flask minio factory
A package, which provides easy usage for minio with flask.
Via this package you can easily create this connection
- with directly creating a minio instance
- or by using the application factory pattern
Intallation
You can install the package from pip:
pip install flask-minio-factory
Usage
If you want to create a minio instance directly you can achieve it by:
from flask import Flask
from flask_minio import Minio
app = Flask(__name__)
minio_client = Minio(app)
If you want to create the client via the application factory, you are able to do that with:
from flask import Flask, send_file
from flask_minio import Minio
app = Flask(__name__)
minio = Minio()
minio.init_app(app)
If you have the client you can simply call the available methods on it:
@app.route("/img/<id_>")
def query_image(id_):
with NamedTemporaryFile(suffix="png") as file:
minio.fget_object("img", id_, file.name)
return send_file(file.name)
(an example code can be tested under /example)
The following config variables are avialble in the flask config:
| Variable | Description | Default |
|---|---|---|
| MINIO_URL | Hostname of a S3 service. | - |
| MINIO_ACCESS_KEY | (Optional) Access key (aka user ID) of your account in S3 service. | - |
| MINIO_SECRET_KEY | (Optional) Secret Key (aka password) of your account in S3 service. | - |
| MINIO_SESSION_TOKEN | (Optional) Session token of your account in S3 service. | - |
| MINIO_SECURE_CONNECTION | (Optional) Flag to indicate to use secure (TLS) connection to S3 service or not. | False |
| MINIO_REGION | (Optional) Region name of buckets in S3 service. | - |
| MINIO_HTTP_CLIENT | (Optional) Customized HTTP client. | - |
| MINIO_CREDENTIALS | (Optional) Credentials of your account in S3 service. | - |
| MINIO_BUCKETS | (Optional) A list of buckets, that should be created at startup | - |
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask_minio_factory-0.1.2.tar.gz.
File metadata
- Download URL: flask_minio_factory-0.1.2.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9405b87e92527576ac1d0c933b02d877becc81b8b74cbc14b1502bf90dca745d
|
|
| MD5 |
b3622c6e0dd455425d9d16c34b273a5c
|
|
| BLAKE2b-256 |
04244b8251eb81abc9acb470fa34ae890873c35ec2c7873aeeaf896409ae9fc9
|
File details
Details for the file flask_minio_factory-0.1.2-py3-none-any.whl.
File metadata
- Download URL: flask_minio_factory-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48461dedb73bf4e6a6b95b72a8c2a95423c3d875f4248a15444ef4dc5559bafc
|
|
| MD5 |
69b3a5f7272d13c67ecd427e51dd8fe6
|
|
| BLAKE2b-256 |
50384ecfc51c054741f41fcbc2d8b685ba3bd689941d00bc54aff04b03dba136
|