Install & Compatibility
Where this runs
tested against v0.2.11 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.496s · 61.6MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 9.0s · import 1.392s · 64MB
62MB installed
● package 62MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
AioBucket
✓ from aiooss2 import AioBucket
✗ from aiooss2.bucket import AioBucket
AioBucket is exposed at top-level; do not import from submodule.
AioService
✓ from aiooss2 import AioService
resumable_upload
✓ from aiooss2 import resumable_upload
resumable_download
✓ from aiooss2 import resumable_download
Basic usage: create Auth, AioBucket, list objects, upload file.
import asyncio
from aiooss2 import AioBucket, AioService, Auth
async def main():
auth = Auth(os.environ.get('OSS_ACCESS_KEY_ID', ''), os.environ.get('OSS_ACCESS_KEY_SECRET', ''))
service = AioService(auth, 'https://oss-cn-hangzhou.aliyuncs.com')
bucket = AioBucket(auth, 'my-bucket', 'oss-cn-hangzhou')
# List objects
async for obj in bucket.list_objects():
print(obj.key)
# Upload file
with open('local.txt', 'rb') as f:
result = await bucket.put_object('remote.txt', f)
await service.close()
asyncio.run(main())
Errors
Common errors & fixes
RuntimeError: Cannot close a running event loop
Calling await bucket.close() or service.close() inside a running event loop.
fixRemove explicit close() or restructure to avoid closing inside loop; typically service is closed after all operations.
AttributeError: module 'aiooss2' has no attribute 'AioBucket'
Importing from aiooss2 before version 0.2.5 where top-level exports were added.
fixUpgrade to >=0.2.5 or import from lower level: from aiooss2.bucket import AioBucket
oss2.exceptions.RequestError: ('Connection aborted.', ...)
Missing or incorrect endpoint; often wrong region or protocol mismatch.
fixEnsure endpoint string includes 'https://' prefix, e.g., 'https://oss-cn-hangzhou.aliyuncs.com'.
Upgrade
Version history
0.2.11latest on PyPI · released Apr 14, 2024
Audit
Dependencies
oss2requiredCore dependency for OSS operations (sync counterpart).
aiohttprequiredAsync HTTP client.