Skip to main content

Asynchronous MinIO Client SDK for Python

Project description

miniopy-async

PyPI PyPI - Python Version PyPI - Downloads

Asynchronous MinIO Client SDK for Python

Build from Source

git clone https://github.com/hlf20010508/miniopy-async.git
cd miniopy-async
poetry install
poetry build

Installation

PyPI

pip install miniopy-async

Github Repository

pip install git+https://github.com/hlf20010508/miniopy-async.git

Quick Start

from miniopy_async import Minio
import asyncio


async def main():
    async with Minio(
        "play.min.io",
        access_key="Q3AM3UQ867SPQQA43P2F",
        secret_key="zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG",
        secure=True,  # http for False, https for True
    ) as client:
        url = await client.presigned_get_object("my-bucket", "my-object")
        print("url:", url)


asyncio.run(main())
from sanic import Sanic, response
from miniopy_async import Minio
from urllib import parse

app = Sanic(__name__)

client = Minio(
    "play.min.io",
    access_key="Q3AM3UQ867SPQQA43P2F",
    secret_key="zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG",
    secure=True,  # http for False, https for True
)


# http://127.0.0.1:8000/download?bucket=my-bucket&fileName=testfile
@app.route("/download", methods=["GET"])
async def download(request):
    print("downloading ...")
    bucket = request.args.get("bucket")
    fileName = request.args.get("fileName")

    # decodeURI, for those which has other language in fileName, such as Chinese, Japanese, Korean
    fileName = parse.unquote(fileName)

    url = await client.presigned_get_object(bucket_name=bucket, object_name=fileName)
    return response.redirect(url)


@app.after_server_stop
async def close_minio_client(*_):
    await client.close_session()

Project details


Download files

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

Source Distribution

miniopy_async-1.23.5.tar.gz (80.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

miniopy_async-1.23.5-py3-none-any.whl (100.7 kB view details)

Uploaded Python 3

File details

Details for the file miniopy_async-1.23.5.tar.gz.

File metadata

  • Download URL: miniopy_async-1.23.5.tar.gz
  • Upload date:
  • Size: 80.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.16 Linux/6.17.0-1008-azure

File hashes

Hashes for miniopy_async-1.23.5.tar.gz
Algorithm Hash digest
SHA256 33a559b3b63f82e34ac48e2b3e999edae7da3640788996a2633287cb4100d7f1
MD5 b1992ffe1e9d78688ecb588e21d015c1
BLAKE2b-256 f9a5d8d26e63a36f43e0fcacc26998ea3c80f57c927c4fb52f2d68d0eedc6bee

See more details on using hashes here.

File details

Details for the file miniopy_async-1.23.5-py3-none-any.whl.

File metadata

  • Download URL: miniopy_async-1.23.5-py3-none-any.whl
  • Upload date:
  • Size: 100.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.16 Linux/6.17.0-1008-azure

File hashes

Hashes for miniopy_async-1.23.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9f27944eb16b3e29fd9440466192e73a14c30f370d53ccb1843c517b480e8467
MD5 a6471343f107c6d3c046d5085189814c
BLAKE2b-256 6c8f317a93e6647777c28bac5a8241cc8fbf0f7c93dea2b2b78b59d005a098c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page