Skip to main content

aliyun oss sdk for python async

Project description

ossx

Coverage Status PyPI version

ossx is an Aliyun OSS SDK for Python Asyncio.

You are free to extend this project, but it's recommended to always run the unit tests to ensure the existing functionality works as expected.

Implementation Details

ossx uses httpx as the asynchronous http client, and makes the greatest effort to reuse oss2 code. Therefore, the code of ossx itself is very small, and in addition, ossx also adds type annotations for public methods.

From the user's perspective, the use of ossx and oss2 should be very similar, in most cases you only need to add an await. Only when streaming reading Object, you need to call await obj.read() or asynchronous iteration async for chunk in obj.

Please note, this library will monkey patch a small number of functions in the oss2 library, usually we believe this will not affect the independent use of the oss2 library, for details please see ossx/patch.py.

Compatibility

Starting from version 2.18.4, ossx will synchronize with the version numbers of the official Aliyun SDK in subsequent releases. When releasing new versions, OSSX will strive to achieve forward compatibility as much as possible. Currently, we guarantee that a minor version of OSSX can be compatible with lower versions of oss2.

It is recommended to keep the version numbers of ossx and oss2 consistent to reduce compatibility issues.

Getting Started

Installation

pip install ossx

Usage

import asyncio
from oss2 import Auth, models
from ossx import AsyncBucket

async def main():
    bucket = AsyncBucket(
        auth=Auth('your-access-key-id', 'your-access-key-secret'),
        endpoint='oss-cn-beijing.aliyuncs.com',
        bucket_name='your-bucket-name'
    )
    content = b'Hello, ossx!'
    await bucket.put_object('your-object-key', content)
    obj = await bucket.get_object('your-object-key')
    assert isinstance(obj, models.GetObjectResult)
    assert await obj.read() == content
    assert await obj.read() == b''

if __name__ == '__main__':
    asyncio.run(main())

You can find the API use cases currently supported in the tests directory.

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

ossx-2.19.1.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

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

ossx-2.19.1-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file ossx-2.19.1.tar.gz.

File metadata

  • Download URL: ossx-2.19.1.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Darwin/23.6.0

File hashes

Hashes for ossx-2.19.1.tar.gz
Algorithm Hash digest
SHA256 c7e7ce87eb806786ca1d0cdf9b4ecf313b98b9fe26f357b0f84928cc3571e570
MD5 0999b44985db5837ba7b84156ffdda75
BLAKE2b-256 8f31e05d923b4898b9efe0a670edd4002600608622b38a4fcc9c18ef567b38bd

See more details on using hashes here.

File details

Details for the file ossx-2.19.1-py3-none-any.whl.

File metadata

  • Download URL: ossx-2.19.1-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Darwin/23.6.0

File hashes

Hashes for ossx-2.19.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9f0850910ef535480d1a72650f420e1a987c061b59115008936ffca98a19a0f
MD5 15d087c38dc8eae5bd8c6514d592b2a0
BLAKE2b-256 897f3637dd9f86a06778edb66da52a3afd5ce0c88239ebcd1d6c14dbfab9c2f2

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