Based on https://github.com/aliyun/aliyun-oss-python-sdk
文档参考官方文档, 调用io操作的接口前加await即可
result = await bucket.get_object(...
获取返回内容:
body = await result.resp.read()
Getting started
# -*- coding: utf-8 -*-
import aiooss
endpoint = 'http://oss-cn-hangzhou.aliyuncs.com' # Suppose that your bucket is in the Hangzhou region.
auth = aiooss.Auth('<Your AccessKeyID>', '<Your AccessKeySecret>')
async def go(loop):
# The object key in the bucket is story.txt
async with aiooss.Bucket(auth, endpoint, '<your bucket name>') as bucket:
key = 'story.txt'
# Upload
await bucket.put_object(key, 'Ali Baba is a happy youth.')
# Upload
data = dict(a=1, b=2)
await bucket.put_object(key, json.dumps(data), headers={'Content-Type': 'application/json'})
# Download
result = await bucket.get_object(key)
print(result.headers)
print(await result.resp.read())
# Delete
await bucket.delete_object(key)
# Traverse all objects in the bucket
async for object_info in aiooss.ObjectIterator(bucket):
print(object_info.key)
loop = asyncio.get_event_loop()
loop.run_until_complete(go(loop))
Metadata
Release files for aiooss 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aiooss-0.1.2.tar.gz | 16.3 kB | Without provenance | Details for aiooss-0.1.2.tar.gz |
Release files / aiooss-0.1.2.tar.gz
| Download URL | aiooss-0.1.2.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d0b38e8a07c9889af392b9d90bb41330377630e227c5693d50b782185b586de
|
|
BLAKE2b-256 checksum How to use checksums |
9d6bea9956f2c7a1608a93eaa7972dc1d71cc66f34d3ebf3434613865d996f7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for aiooss 0.1.2
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.