An asynchronous python client SDK for OSS(Aliyun Object Storage Service).
Project description
An asynchronous python client SDK for OSS(Aliyun Object Storage Service).
It has been verified and used in the production environment with QPS ≈ 500 for about half a year, so you can use it with confidence.
Installation
PyPI (recommend)
$ pip install asyncio-oss
Local compilation
$ git clone git@github.com:Yaocool/async-oss.git
$ python setup.py bdist_wheel
$ pip install ./dist/asyncio_oss-*-py3-none-any.whl
Examples
For more examples, please refer to the test directory.
import logging
import asyncio_oss
import asyncio
import oss2
OSS_ENDPOINT = 'https://oss-cn-hangzhou.aliyuncs.com' # definition in https://help.aliyun.com/document_detail/31837.html
OSS_KEY = '<Your AccessKeyID>'
OSS_SECRET = '<Your AccessKeySecret>'
OSS_AUTH = oss2.Auth(OSS_KEY, OSS_SECRET)
BUCKET_NAME = '<your bucket name>'
OBJECT_KEY = '<your object key>'
async def main():
async with asyncio_oss.Bucket(OSS_AUTH, OSS_ENDPOINT, BUCKET_NAME) as bucket:
# Put Object
await bucket.put_object(OBJECT_KEY, b'your bytes data')
# Get Object
result = await bucket.get_object(OBJECT_KEY)
await result.read()
# Head Object
head_res = await bucket.head_object(OBJECT_KEY)
print(head_res.content_length)
# List Objects
for obj in (await bucket.list_objects()).object_list:
print(obj.key)
# Delete Object
await bucket.delete_object(OBJECT_KEY)
if __name__ == '__main__':
# open global log
log_file_path = "example_logfile.log"
asyncio_oss.set_file_logger(log_file_path, 'asyncio_oss', logging.DEBUG)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Contributors Wall
Discussions Or Issues
Any questions can be raised in Discussions
or Issues
, I will answer them from time to time.
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
asyncio_oss-1.1.5.tar.gz
(40.2 kB
view details)
Built Distribution
File details
Details for the file asyncio_oss-1.1.5.tar.gz
.
File metadata
- Download URL: asyncio_oss-1.1.5.tar.gz
- Upload date:
- Size: 40.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2697b7da981fe2dea761f3f69f9daba265113b9c5e1ba487213c4e79ac392b6f |
|
MD5 | 8f8f825bfe6148e56d74dd0dc46da0ef |
|
BLAKE2b-256 | c9bbc2ab8d2be09c48815601dce2e5acde79de3c35c59edd5e0fcb33ae5c5a2f |
File details
Details for the file asyncio_oss-1.1.5-py3-none-any.whl
.
File metadata
- Download URL: asyncio_oss-1.1.5-py3-none-any.whl
- Upload date:
- Size: 41.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09eb5a1cfdacc2b834e8df53c56367565e064dee14fcf718c4430b6703d7cccf |
|
MD5 | 4108b165a02ee564a482a1ccc322e4b2 |
|
BLAKE2b-256 | 2bf8a0937118f052b978de42657c9a9da7af209d1f0d91ed8fbce824612293b5 |