Skip to main content

An asynchronous python client SDK for OSS(Aliyun Object Storage Service).

It has been verified and used in the production environment with QPS ≈ 500 for about half a year, so you can use it with confidence.

Installation

PyPI (recommend)

$ pip install asyncio-oss

Local compilation

$ git clone git@github.com:Yaocool/async-oss.git
$ python setup.py bdist_wheel
$ pip install ./dist/asyncio_oss-*-py3-none-any.whl

Examples

For more examples, please refer to the test directory.

import logging

import asyncio_oss
import asyncio
import oss2

OSS_ENDPOINT = 'https://oss-cn-hangzhou.aliyuncs.com'  # definition in https://help.aliyun.com/document_detail/31837.html
OSS_KEY = '<Your AccessKeyID>'
OSS_SECRET = '<Your AccessKeySecret>'
OSS_AUTH = oss2.Auth(OSS_KEY, OSS_SECRET)
BUCKET_NAME = '<your bucket name>'
OBJECT_KEY = '<your object key>'


async def main():
    async with asyncio_oss.Bucket(OSS_AUTH, OSS_ENDPOINT, BUCKET_NAME) as bucket:
        # Put Object
        await bucket.put_object(OBJECT_KEY, b'your bytes data')

        # Get Object
        result = await bucket.get_object(OBJECT_KEY)
        await result.read()
        
        # Head Object
        head_res = await bucket.head_object(OBJECT_KEY)
        print(head_res.content_length)
        
        # List Objects
        for obj in (await bucket.list_objects()).object_list:
            print(obj.key)

        # Delete Object
        await bucket.delete_object(OBJECT_KEY)


if __name__ == '__main__':
    # open global log
    log_file_path = "example_logfile.log"
    asyncio_oss.set_file_logger(log_file_path, 'asyncio_oss', logging.DEBUG)
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())

Contributors Wall

Discussions Or Issues

Any questions can be raised in Discussions or Issues, I will answer them from time to time.

Metadata

Release files for asyncio-oss 1.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asyncio-oss 1.1.5
File Size Uploaded Provenance Actions
asyncio_oss-1.1.5.tar.gz 40.2 kB Without provenance Details for asyncio_oss-1.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for asyncio-oss 1.1.5
File Interpreter ABI Platform Actions
asyncio_oss-1.1.5-py3-none-any.whl Python 3 none any Details for asyncio_oss-1.1.5-py3-none-any.whl

Total release size: 81.9 kB

Release files / asyncio_oss-1.1.5.tar.gz

Download URL asyncio_oss-1.1.5.tar.gz
Size 40.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2697b7da981fe2dea761f3f69f9daba265113b9c5e1ba487213c4e79ac392b6f
BLAKE2b-256 checksum
How to use checksums
c9bbc2ab8d2be09c48815601dce2e5acde79de3c35c59edd5e0fcb33ae5c5a2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / asyncio_oss-1.1.5-py3-none-any.whl

Download URL asyncio_oss-1.1.5-py3-none-any.whl
Size 41.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09eb5a1cfdacc2b834e8df53c56367565e064dee14fcf718c4430b6703d7cccf
BLAKE2b-256 checksum
How to use checksums
2bf8a0937118f052b978de42657c9a9da7af209d1f0d91ed8fbce824612293b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Security for asyncio-oss 1.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page