Giter Club home page Giter Club logo

flask-minio's People

Contributors

fffaez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flask-minio's Issues

NoSuchBucket while copy object

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 ?

Allow configuration via single MINIO_URI rather than five

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.

Why mount minio instance to flask_app_ctx

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

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.