{"id":23218,"library":"aiooss2","title":"aiooss2","description":"Async client for Alibaba Cloud OSS (Object Storage Service), built on oss2 and aiohttp/asyncio. Current version 0.2.11, released Mar 2024. Low release cadence (last release 0.2.11). Requires Python >=3.8.","status":"active","version":"0.2.11","language":"python","source_language":"en","source_url":"https://github.com/karajan1001/aiooss2","tags":["async","oss","aliyun","object-storage","aiohttp"],"install":[{"cmd":"pip install aiooss2","lang":"bash","label":"Default install"}],"dependencies":[{"reason":"Core dependency for OSS operations (sync counterpart).","package":"oss2","optional":false},{"reason":"Async HTTP client.","package":"aiohttp","optional":false}],"imports":[{"note":"AioBucket is exposed at top-level; do not import from submodule.","wrong":"from aiooss2.bucket import AioBucket","symbol":"AioBucket","correct":"from aiooss2 import AioBucket"},{"note":"","symbol":"AioService","correct":"from aiooss2 import AioService"},{"note":"","symbol":"resumable_upload","correct":"from aiooss2 import resumable_upload"},{"note":"","symbol":"resumable_download","correct":"from aiooss2 import resumable_download"}],"quickstart":{"code":"import asyncio\nfrom aiooss2 import AioBucket, AioService, Auth\n\nasync def main():\n    auth = Auth(os.environ.get('OSS_ACCESS_KEY_ID', ''), os.environ.get('OSS_ACCESS_KEY_SECRET', ''))\n    service = AioService(auth, 'https://oss-cn-hangzhou.aliyuncs.com')\n    bucket = AioBucket(auth, 'my-bucket', 'oss-cn-hangzhou')\n    # List objects\n    async for obj in bucket.list_objects():\n        print(obj.key)\n    # Upload file\n    with open('local.txt', 'rb') as f:\n        result = await bucket.put_object('remote.txt', f)\n    await service.close()\n\nasyncio.run(main())","lang":"python","description":"Basic usage: create Auth, AioBucket, list objects, upload file."},"warnings":[{"fix":"Always create AioBucket/AioService inside a coroutine, typically after asyncio.run(main()).","message":"AioBucket and AioService require an event loop to be running. Do not instantiate them before asyncio.run() or outside async context.","severity":"gotcha","affected_versions":"all"},{"fix":"Use string path: await resumable_upload(bucket, 'remote_key', '/local/path')","message":"For resumable_upload and resumable_download, the source argument must be a file path string, not a file-like object. Passing a file object silently fails.","severity":"gotcha","affected_versions":">=0.2.4"},{"fix":"Always await: result = await bucket.put_object(...)","message":"The async methods on AioBucket return coroutines directly; no need to wrap in asyncio.ensure_future(). Failing to await them will raise RuntimeWarning.","severity":"gotcha","affected_versions":"all"},{"fix":"Use AioBucket(auth, bucket_name, endpoint_name) with explicit keyword or positional as per current docs.","message":"Using positional arguments for endpoints is deprecated in favor of keyword arguments for clarity.","severity":"deprecated","affected_versions":">=0.2.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Remove explicit close() or restructure to avoid closing inside loop; typically service is closed after all operations.","cause":"Calling await bucket.close() or service.close() inside a running event loop.","error":"RuntimeError: Cannot close a running event loop"},{"fix":"Upgrade to >=0.2.5 or import from lower level: from aiooss2.bucket import AioBucket","cause":"Importing from aiooss2 before version 0.2.5 where top-level exports were added.","error":"AttributeError: module 'aiooss2' has no attribute 'AioBucket'"},{"fix":"Ensure endpoint string includes 'https://' prefix, e.g., 'https://oss-cn-hangzhou.aliyuncs.com'.","cause":"Missing or incorrect endpoint; often wrong region or protocol mismatch.","error":"oss2.exceptions.RequestError: ('Connection aborted.', ...)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}