alejandroandreu / flask-minio Goto Github PK
View Code? Open in Web Editor NEWFlask extension to interface with Minio
License: BSD 2-Clause "Simplified" License
Flask extension to interface with Minio
License: BSD 2-Clause "Simplified" License
I'll keep getting "minio.error.NoSuchBucket: NoSuchBucket: message: The specified bucket does not exist." error. But i have created the bucket and i'm using get object method to get files,
but when i try to copy object i get this error. what's wong ?
I have my configuration set up to take a single URI in the following format:
MINIO_URI=minio+secure://username:password@hostname:port/bucket
which basically mirrors SQLAlchemy's format. I parse it with the following config method:
def process_minio_string(minio_uri: str) -> dict[str, str]:
"""Turn a minio URI string into split usable variables.
URI format is: minio+secure://username:password@hostname:port/bucket
This works from the right and left separately to get to password. This
ensures that there are no issues splitting strings when the password contains
special characters."""
# Work from left to password
prefix, _, uri = minio_uri.partition("+")
secure, _, uri = uri.partition("://")
username, _, uri = uri.partition(":")
# Work from right to password
uri, _, bucket = uri.rpartition("/")
uri, _, port = uri.rpartition(":")
password, _, hostname = uri.rpartition("@")
if prefix != "minio":
raise TypeError("Minio URI appears to be of wrong type")
if secure == "secure":
sec = 1
elif secure == "insecure":
sec = 0
else:
raise TypeError("Minio string security must be 'secure' or 'insecure'.")
return {
"secure": sec,
"username": username,
"password": password,
"hostname": hostname,
"bucket": bucket,
"port": port,
"endpoint": f"{hostname}:{port}",
}
From this dict I am able to configure all the options, and have a default bucket.
I think this would be a nice option to roll into flask-minio. It would save a little bit of config namespace clutter and keep related information together better.
I don't understand the purpose of binding minio instances to flask application context, i hope the author can solve my doubts
def connection(self):
ctx = _app_ctx_stack.top
if ctx is not None:
if not hasattr(ctx, 'minio'):
ctx.minio = self.connect()
return ctx.minio
just have a problem: every request will call connect.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.