Skip to main content

aliyun oss sdk for python asyncio

Project description

ossx

Build Status 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.

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''

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-0.2.18a2.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

ossx-0.2.18a2-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file ossx-0.2.18a2.tar.gz.

File metadata

  • Download URL: ossx-0.2.18a2.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.1

File hashes

Hashes for ossx-0.2.18a2.tar.gz
Algorithm Hash digest
SHA256 6bf3ac1c8342bf1475849fe7b0affde2d8d2a242a03d526c8152a5a5350fdb38
MD5 f1c5dfdfa1e66ed71e1872204c6c5d09
BLAKE2b-256 89162b5c529fff6c38644539e45b209e6c534f5e15465a5111150b3e6fc942ab

See more details on using hashes here.

File details

Details for the file ossx-0.2.18a2-py3-none-any.whl.

File metadata

  • Download URL: ossx-0.2.18a2-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.1

File hashes

Hashes for ossx-0.2.18a2-py3-none-any.whl
Algorithm Hash digest
SHA256 35e01fdce599b24703e5cd2cca429002b1b1315f6597e606884d5af033dfd22c
MD5 534d1f00f6f472ac40b1f58592f582c4
BLAKE2b-256 65d6a3b8c7575e79f9a81ec1fd4f3a6d0206c70e2e18c550b3d9c275afb107be

See more details on using hashes here.

Supported by

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